Skip to content

Conversation

@jroachgolf84
Copy link
Collaborator

@jroachgolf84 jroachgolf84 commented Apr 21, 2025

Pull request to add DatabricksSQLStatementsSensor Sensor with deferrability.

Currently, there is an existing DatabricksSqlSensor. However, this Sensor has faulty implementation, and actually executes a query on each poke. Recently, #48507 was merged by @pankajkoti to create a DatabricksSQLStatementsOperator. This Sensor quite closely mirrors that implementation, but with a few distinct capabilities.

  • The ability to provide a statement_id, rather than a SQL statement.
  • Leveraging the behavior of a Sensor to free Worker slots.

This PR also introduces the DatabricksSQLStatementsMixin to take much of the overlapping logic between DatabricksSQLStatementsSensor and DatabricksSQLStatementsOperator and make it reusable.

These changes both the Operator and Sensor were fully tested, and an example Task was added.

Closes: #48368

@jroachgolf84
Copy link
Collaborator Author

cc: @pankajkoti, I've created a draft PR. Do you mind take a look at this?

@jroachgolf84 jroachgolf84 changed the title Adding DatabricksSQLStatementSensor Operator with Deferrability Adding DatabricksSQLStatementSensor Sensor with Deferrability Apr 21, 2025
@jroachgolf84 jroachgolf84 marked this pull request as ready for review April 22, 2025 19:37
@jroachgolf84
Copy link
Collaborator Author

Team, can I please request a review on this issue?

@potiuk
Copy link
Member

potiuk commented May 1, 2025

LGTM. The code looks good but I'd appreciate another review @alexott maybe ?

Copy link
Contributor

@alexott alexott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix some small things, but it's good in general

@jroachgolf84
Copy link
Collaborator Author

I'll go ahead and make those changes. Thanks!

@jroachgolf84
Copy link
Collaborator Author

Thanks for the feedback - I've implemented those changes.

@jroachgolf84 jroachgolf84 requested a review from alexott May 1, 2025 13:23
Copy link
Member

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Have some inline comments about docs. I was also able to do a quick sanity run on example DAGs using the operator and sensor. Thanks for contributing this. And apologies for the delay in the review here, was caught up with getting a release ready at work 🙇🏽

I am good to merge once the comments from @alexott are considered/resolved.

@jroachgolf84
Copy link
Collaborator Author

Changes made and implemented!

@jroachgolf84
Copy link
Collaborator Author

Are we good to go ahead and merge this?

@jroachgolf84
Copy link
Collaborator Author

@eladkal, changes implemented, should be all set to go!

@RNHTTR RNHTTR merged commit 4425074 into apache:main May 15, 2025
68 checks passed
sanederchik pushed a commit to sanederchik/airflow that referenced this pull request Jun 7, 2025
…he#49516)

* Adding mixin, Sensor, and updated Operator to create a draft PR

* Prepping to update branch

* Adding tests for DatabricksSQLStatementSensor

* Added unit tests and examples

* Added documentation, pointed ignore tests on mixin

* Implementing changes requested in PR

* Tweaking example DAG

* Adding validation, updating docs

* Updated example DAG

* Adding test for Databricks mixins

* Updated test_project_structure.py
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.

DatabricksSqlSensor deferrable

6 participants