Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit To Prevent Usage of session.query #47275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Prab-27
Copy link
Contributor

@Prab-27 Prab-27 commented Mar 2, 2025

closes : #45461
Introduce a pre-commit hook to prevent the use of session.query in the core Airflow code.
This is limited to the source code and excludes the tests/ package.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@Prab-27
Copy link
Contributor Author

Prab-27 commented Mar 2, 2025

I will raise a PR soon for removing session.query() from airflow-core and task-sdk as we discussed in #45714

@Prab-27 Prab-27 force-pushed the add-pre-commit-to-prevent-usage-session.query branch from 5d4d4dc to b6775a8 Compare March 2, 2025 14:07
language: python
additional_dependencies: ['rich>=12.4.4']
files: ^airflow.*\.py$|^task_sdk.*\.py
exclude: ^tests/.*\.py$|^task_sdk/tests/.*\.py$
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
exclude: ^tests/.*\.py$|^task_sdk/tests/.*\.py$

Since we have given it specific files to check, do we still need to exclude others?

@ephraimbuddy
Copy link
Contributor

I will raise a PR soon for removing session.query() from airflow-core and task-sdk as we discussed in #45714

You can do it in this PR. This PR should raise and point to where there are usages of session.query

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.

Add pre-commit to prevent usage of session.query in Airflow Core
2 participants