Dev-iL commented on PR #55274: URL: https://github.com/apache/airflow/pull/55274#issuecomment-3263733882
Here's what Gemini had to say: > Based on the SQLAlchemy 1.4 to 2.0 migration documentation, here are some additional checks to include in the pre-commit hook to detect deprecated patterns: > > ### Deprecated `Query` Object and its Usage > > The provided script already checks for `session.query()` and `from sqlalchemy.orm import Query`, which is excellent. Other checks could include looking for the direct use of the `Query` object in other contexts. > > ### Deprecated `declarative` Module > > The `sqlalchemy.ext.declarative` package has been integrated into `sqlalchemy.orm`. While the old names still exist, they issue deprecation warnings. The pre-commit hook could check for the following: > > * **Imports:** Flag any imports from `sqlalchemy.ext.declarative`. > * **Function Calls:** Look for calls to `sqlalchemy.ext.declarative.declarative_base()` and `sqlalchemy.ext.declarative.declared_attr()`. > > ### Deprecated Mapping Functions > > Direct calls to `mapper()` and `instrument_declarative()` are deprecated. The hook can be extended to find and flag these function calls, suggesting a move to the new `registry` methods. > > * **Classical Mapping:** Look for direct calls to `sqlalchemy.orm.mapper()`. > * **Imperative Mapping:** Check for calls to `sqlalchemy.orm.instrument_declarative()`. > > ### Deprecated `RowProxy` and `KeyedTuple` > > While these are less about code syntax and more about return types, a static analysis tool could potentially detect their usage if they are explicitly typed or a comment refers to them. A more practical check for a pre-commit hook would be to focus on the function calls that produce these deprecated types. > > ### Other Deprecated Features > > The hook can also be expanded to detect other deprecated behaviors mentioned in the documentation, such as `cascade_backrefs`. This would involve looking for `cascade` arguments that include `backrefs` within `relationship()` calls. -- 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