Skip to content

Conversation

@fweilun
Copy link
Contributor

@fweilun fweilun commented Jul 18, 2025

related: #53395

The run method in DbApiHook did not include list[str] as a possible return type,
even though certain handlers like fetch_one_handler or custom handlers can return it.

This caused MyPy to raise unreachable code errors in providers such as teradata
when checking for list[str] results.

This commit updates the type annotations in both sql.py and sql.pyi to reflect
this valid case and unblock downstream MyPy type-checking.

No functional changes. All tests continue to pass.

@gopidesupavan
Copy link
Member

some mypy checks failing

@fweilun fweilun force-pushed the remove-or-fix-unreachable-code-in-teradata-provider branch from 9f746f3 to 51a1613 Compare July 21, 2025 06:46
@fweilun fweilun changed the title fix(common.sql): include list[str] in DbApiHook.run return type for MyPy compatibility Fix unreachable code mypy warnings in teradata provider Jul 21, 2025
@fweilun fweilun closed this Jul 21, 2025
@fweilun fweilun reopened this Jul 21, 2025
@fweilun
Copy link
Contributor Author

fweilun commented Jul 22, 2025

HI @gopidesupavan , I’ve fixed the MyPy warnings for this provider.
However, some Breeze test errors came up that don’t seem related to my changes — still checking.

@potiuk potiuk force-pushed the remove-or-fix-unreachable-code-in-teradata-provider branch from 1afdcdc to c284fe7 Compare July 22, 2025 13:53
@potiuk
Copy link
Member

potiuk commented Jul 22, 2025

HI @gopidesupavan , I’ve fixed the MyPy warnings for this provider. However, some Breeze test errors came up that don’t seem related to my changes — still checking.

Just rebased. Likely intermittent

@eladkal eladkal requested a review from gopidesupavan July 25, 2025 15:43
@gopidesupavan gopidesupavan merged commit 64e7408 into apache:main Jul 25, 2025
75 checks passed
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
* include list[str] in DbApiHook.run return type to resolve MyPy unreachable warnings

* fix: update dialect.py return type to match run()

* generalize SQL result type from list[str] to list for broader compatibility
fweilun added a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
* include list[str] in DbApiHook.run return type to resolve MyPy unreachable warnings

* fix: update dialect.py return type to match run()

* generalize SQL result type from list[str] to list for broader compatibility
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.

3 participants