Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
potiuk commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2997115034 > @potiuk Would love to hear your thoughts on this. Sure. Also you might split per module in "core". I think what works best is if you do one or two yourself - some representative examples of PRs - and provide instructions to others based on thsose PRs. That avoids any ambiguities with description and speeds up people ramping up -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2996918238 I've created a list as you suggested Total changes needed files : 116 Including - ``` airflow-core - 10 files airflow-core tests - 49 files dev - 1 files devel-common - 6 files Providers - including tests - 50 files ``` My Plan : Single file checks for all - 66 files Providers - chnages as per module which has session.query - including tests and Providers both @potiuk Would love to hear your thoughts on this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
potiuk commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2994956989 > > Instead of trying to fix everything in this PR, it might be easier to submit smaller PRs fixing things one by one, and rebase this repeatedly after each PR is merged until CI is green. > Yep - it could also be done similar to the https://github.com/apache/airflow/issues/52020 * find all files/folders that need fixing * convert them to a list * implement a mechanism (.pre-comit files selection) that includes certain folders in .pre-commit check * ask for help (and do yourself some of that) with PRs that incrementally fix things and add stuff to be checked by .pre-commit so that no session is added to already "cleaned" folders * when completed, switch it to check "everywhere". -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2995070842 > > > Instead of trying to fix everything in this PR, it might be easier to submit smaller PRs fixing things one by one, and rebase this repeatedly after each PR is merged until CI is green. > > Yep - it could also be done similar to the #52020 > > * find all files/folders that need fixing > * convert them to a list > * implement a mechanism (.pre-comit files selection) that includes certain folders in .pre-commit check > * ask for help (and do yourself some of that) with PRs that incrementally fix things and add stuff to be checked by .pre-commit so that no session is added to already "cleaned" folders > * when completed, switch it to check "everywhere". Thanks for pointing me in the right direction. I’m diving into it now -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2994926896 > Instead of trying to fix everything in this PR, it might be easier to submit smaller PRs fixing things one by one, and rebase this repeatedly after each PR is merged until CI is green. Thanks for the suggestion—I'll proceed with that plan. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
uranusjr commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2994856487 Instead of trying to fix everything in this PR, it might be easier to submit smaller PRs fixing things one by one, and rebase this repeatedly after each PR is merged until CI is green. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
uranusjr commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2160682433 ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -124,8 +126,9 @@ def parse_config(self) -> None: @provide_session def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: self.log.debug("Syncing DAG bundles to the database") -stored = {b.name: b for b in session.query(DagBundleModel).all()} -for name in self._bundle_config.keys(): +stored = {b.name: b for b in session.scalars(select(DagBundleModel)).all()} +active_bundle_names = set(self._bundle_config.keys()) +for name in active_bundle_names: Review Comment: ```suggestion stored = dict(session.execute(select(DagBundleModel.name, DagBundleModel))) for name in self._bundle_config: ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
uranusjr commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2160682433 ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -124,8 +126,9 @@ def parse_config(self) -> None: @provide_session def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: self.log.debug("Syncing DAG bundles to the database") -stored = {b.name: b for b in session.query(DagBundleModel).all()} -for name in self._bundle_config.keys(): +stored = {b.name: b for b in session.scalars(select(DagBundleModel)).all()} +active_bundle_names = set(self._bundle_config.keys()) +for name in active_bundle_names: Review Comment: ```suggestion stored = dict(session.execute(select(DagBundleModel.name, DagBundleModel))) for name in self._bundle_config: ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2160314980 ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -165,13 +166,12 @@ def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: if inactive_bundle_names and active_bundle_names: new_bundle_name = sorted(active_bundle_names)[0] -updated_rows = ( -session.query(DagVersion) -.filter(DagVersion.bundle_name.in_(inactive_bundle_names)) -.update( -{DagVersion.bundle_name: new_bundle_name}, -synchronize_session=False, -) + +updated_rows = session.execute( +update(DagVersion) +.where(DagVersion.bundle_name.in_(inactive_bundle_names)) +.values({DagVersion.bundle_name: new_bundle_name}) Review Comment: This change has been updated so I rebased and resolved it ## airflow-core/src/airflow/dag_processing/collection.py: ## @@ -265,15 +265,17 @@ def _update_import_errors( # Add the errors of the processed files for filename, stacktrace in import_errors.items(): if (filename, bundle_name) in existing_import_error_files: -session.query(ParseImportError).where( -ParseImportError.filename == filename, ParseImportError.bundle_name == bundle_name -).update( -{ -"filename": filename, -"bundle_name": bundle_name, -"timestamp": utcnow(), -"stacktrace": stacktrace, -}, +session.execute( +update(ParseImportError) +.where(ParseImportError.filename == filename, ParseImportError.bundle_name == bundle_name) +.values( +{ +"filename": filename, +"bundle_name": bundle_name, +"timestamp": utcnow(), +"stacktrace": stacktrace, Review Comment: This change has been updated, so I rebased and resolved it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2160312991 ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -149,9 +151,8 @@ def parse_config(self) -> None: @provide_session def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: self.log.debug("Syncing DAG bundles to the database") -stored = {b.name: b for b in session.query(DagBundleModel).all()} -active_bundle_names = set(self._bundle_config.keys()) -for name in active_bundle_names: +stored = {b.name: b for b in session.scalars(select(DagBundleModel)).all()} +for name in self._bundle_config.keys(): Review Comment: It was a mistake. Rebased again and resolved -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2160312626 ## airflow-core/src/airflow/api_fastapi/execution_api/routes/xcoms.py: ## @@ -270,7 +270,7 @@ def set_xcom( if not run_id: raise HTTPException(status.HTTP_404_NOT_FOUND, f"Run with ID: `{run_id}` was not found") -dag_run_id = session.query(DagRun.id).filter_by(dag_id=dag_id, run_id=run_id).scalar() +dag_run_id = session.execute(DagRun.id).where(dag_id=dag_id, run_id=run_id).scalar() Review Comment: Done! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
ephraimbuddy commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r2096164941 ## airflow-core/src/airflow/dag_processing/collection.py: ## @@ -265,15 +265,17 @@ def _update_import_errors( # Add the errors of the processed files for filename, stacktrace in import_errors.items(): if (filename, bundle_name) in existing_import_error_files: -session.query(ParseImportError).where( -ParseImportError.filename == filename, ParseImportError.bundle_name == bundle_name -).update( -{ -"filename": filename, -"bundle_name": bundle_name, -"timestamp": utcnow(), -"stacktrace": stacktrace, -}, +session.execute( +update(ParseImportError) +.where(ParseImportError.filename == filename, ParseImportError.bundle_name == bundle_name) +.values( +{ +"filename": filename, +"bundle_name": bundle_name, +"timestamp": utcnow(), +"stacktrace": stacktrace, Review Comment: values accept keyword args not dictionary ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -149,9 +151,8 @@ def parse_config(self) -> None: @provide_session def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: self.log.debug("Syncing DAG bundles to the database") -stored = {b.name: b for b in session.query(DagBundleModel).all()} -active_bundle_names = set(self._bundle_config.keys()) -for name in active_bundle_names: +stored = {b.name: b for b in session.scalars(select(DagBundleModel)).all()} +for name in self._bundle_config.keys(): Review Comment: Looks like you are omitting the active_bundle_names filter? ## airflow-core/src/airflow/dag_processing/bundles/manager.py: ## @@ -165,13 +166,12 @@ def sync_bundles_to_db(self, *, session: Session = NEW_SESSION) -> None: if inactive_bundle_names and active_bundle_names: new_bundle_name = sorted(active_bundle_names)[0] -updated_rows = ( -session.query(DagVersion) -.filter(DagVersion.bundle_name.in_(inactive_bundle_names)) -.update( -{DagVersion.bundle_name: new_bundle_name}, -synchronize_session=False, -) + +updated_rows = session.execute( +update(DagVersion) +.where(DagVersion.bundle_name.in_(inactive_bundle_names)) +.values({DagVersion.bundle_name: new_bundle_name}) Review Comment: ```suggestion .values(bundle_name=new_bundle_name) ``` ## airflow-core/src/airflow/api_fastapi/execution_api/routes/xcoms.py: ## @@ -270,7 +270,7 @@ def set_xcom( if not run_id: raise HTTPException(status.HTTP_404_NOT_FOUND, f"Run with ID: `{run_id}` was not found") -dag_run_id = session.query(DagRun.id).filter_by(dag_id=dag_id, run_id=run_id).scalar() +dag_run_id = session.execute(DagRun.id).where(dag_id=dag_id, run_id=run_id).scalar() Review Comment: ```suggestion dag_run_id = session.scalar(select(DagRun.id).where(dag_id=dag_id, run_id=run_id)) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2891154334 @ephraimbuddy , Could you please review this PR when you have some free time -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
github-actions[bot] commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2848306008 This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2733973598 I have been trying to update the code but couldn't `query = session.query(base_table).with_entities(text(f"{base_table_alias}.*"))` from [here](https://github.com/apache/airflow/blob/main/airflow/utils/db_cleanup.py) could you please help me upgrade this ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1995662651 ## airflow/models/xcom.py: ## @@ -426,11 +428,13 @@ def clear( if not run_id: raise ValueError(f"run_id must be passed. Passed run_id={run_id}") -query = session.query(BaseXCom).filter_by(dag_id=dag_id, task_id=task_id, run_id=run_id) +query = select(BaseXCom).where( +BaseXCom.dag_id == dag_id, BaseXCom.task_id == task_id, BaseXCom.run_id == run_id +) if map_index is not None: -query = query.filter_by(map_index=map_index) +query = query.where(BaseXCom.map_index == map_index) -for xcom in query: +for xcom in session.execute(query).all(): Review Comment: I am not sure if this works fine for `session.delete(xcom).` Could you please clarify when you get some free time? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1983713250 ## scripts/ci/pre_commit/usage_session_query.py: ## @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import ast +import sys +from pathlib import Path + +from rich.console import Console + +console = Console(color_system="standard", width=200) + + +def check_session_query(mod: ast.Module) -> int: +errors = 0 +for node in ast.walk(mod): +if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute): +if ( +node.func.attr == "query" +and isinstance(node.func.value, ast.Name) +and node.func.value.id == "session" +): +console.print( +f"\nUse of legacy `session.query` detected on line {node.lineno}. " +f"\nSQLAlchemy 2.0 deprecates the `Query` object" +f"use the `select()` construct instead." +) +errors += 1 Review Comment: ya ! you are right !! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1983713250 ## scripts/ci/pre_commit/usage_session_query.py: ## @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import ast +import sys +from pathlib import Path + +from rich.console import Console + +console = Console(color_system="standard", width=200) + + +def check_session_query(mod: ast.Module) -> int: +errors = 0 +for node in ast.walk(mod): +if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute): +if ( +node.func.attr == "query" +and isinstance(node.func.value, ast.Name) +and node.func.value.id == "session" +): +console.print( +f"\nUse of legacy `session.query` detected on line {node.lineno}. " +f"\nSQLAlchemy 2.0 deprecates the `Query` object" +f"use the `select()` construct instead." +) +errors += 1 Review Comment: ya ! you are right !! I'll update it soon -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
bugraoz93 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1980044480 ## scripts/ci/pre_commit/usage_session_query.py: ## @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import ast +import sys +from pathlib import Path + +from rich.console import Console + +console = Console(color_system="standard", width=200) + + +def check_session_query(mod: ast.Module) -> int: +errors = 0 +for node in ast.walk(mod): +if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute): +if ( +node.func.attr == "query" +and isinstance(node.func.value, ast.Name) +and node.func.value.id == "session" +): +console.print( +f"\nUse of legacy `session.query` detected on line {node.lineno}. " +f"\nSQLAlchemy 2.0 deprecates the `Query` object" +f"use the `select()` construct instead." +) +errors += 1 Review Comment: Thanks for the changes! We don't need this integer since occurrence isn't important in return and response text. We could make a return bool and the main can still return one similar to below. This can also do an early exit and reduce scans since a single occurrence should trigger the hook. What do you think? ``` return 1 if check_session_query(ast_module) else 0 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1979841779 ## .pre-commit-config.yaml: ## @@ -205,6 +205,14 @@ repos: files: ^airflow/models/taskinstance.py$|^airflow/models/taskinstancehistory.py$ pass_filenames: false require_serial: true + - id: prevent-usage-of-session.query +name: Prevent usage of session.query +entry: ./scripts/ci/pre_commit/usage_session_query.py +language: python +additional_dependencies: ['rich>=12.4.4'] +files: ^airflow.*\.py$|^task_sdk.*\.py +exclude: ^tests/.*\.py$|^task_sdk/tests/.*\.py$ Review Comment: Ya you are right ! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1979841779 ## .pre-commit-config.yaml: ## @@ -205,6 +205,14 @@ repos: files: ^airflow/models/taskinstance.py$|^airflow/models/taskinstancehistory.py$ pass_filenames: false require_serial: true + - id: prevent-usage-of-session.query +name: Prevent usage of session.query +entry: ./scripts/ci/pre_commit/usage_session_query.py +language: python +additional_dependencies: ['rich>=12.4.4'] +files: ^airflow.*\.py$|^task_sdk.*\.py +exclude: ^tests/.*\.py$|^task_sdk/tests/.*\.py$ Review Comment: Ya you are right ! I'll remove this line -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
ephraimbuddy commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2697220813 > 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 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
ephraimbuddy commented on code in PR #47275: URL: https://github.com/apache/airflow/pull/47275#discussion_r1979239297 ## .pre-commit-config.yaml: ## @@ -205,6 +205,14 @@ repos: files: ^airflow/models/taskinstance.py$|^airflow/models/taskinstancehistory.py$ pass_filenames: false require_serial: true + - id: prevent-usage-of-session.query +name: Prevent usage of session.query +entry: ./scripts/ci/pre_commit/usage_session_query.py +language: python +additional_dependencies: ['rich>=12.4.4'] +files: ^airflow.*\.py$|^task_sdk.*\.py +exclude: ^tests/.*\.py$|^task_sdk/tests/.*\.py$ Review Comment: ```suggestion ``` Since we have given it specific files to check, do we still need to exclude others? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add pre-commit To Prevent Usage of session.query [airflow]
Prab-27 commented on PR #47275: URL: https://github.com/apache/airflow/pull/47275#issuecomment-2692746074 I will raise a PR soon for removing `session.query()` from `airflow-core` and `task-sdk` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org