Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

Saw this error in https://github.com/apache/airflow/actions/runs/14216382230/job/39834390290?pr=48666 recently.

providers/apache/hive/src/airflow/providers/apache/hive/transfers/mssql_to_hive.py:107: error:
"int" has no attribute "value"  [attr-defined]
                pymssql.BINARY.value: "INT",
                ^~~~~~~~~~~~~~~~~~~~
providers/apache/hive/src/airflow/providers/apache/hive/transfers/mssql_to_hive.py:108: error:
"int" has no attribute "value"  [attr-defined]
                pymssql.DECIMAL.value: "FLOAT",
                ^~~~~~~~~~~~~~~~~~~~~
providers/apache/hive/src/airflow/providers/apache/hive/transfers/mssql_to_hive.py:109: error:
"int" has no attribute "value"  [attr-defined]
                pymssql.NUMBER.value: "INT",

pymssql 2.3.4 was installed which likely had some updates in the types due to which mypy complains. I investigated with both the versions and that part hasnt changed.

root@6df56b1b55c6:/opt/airflow# python
Python 3.9.21 (main, Mar 18 2025, 00:53:02)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>> print(type(pymssql.BINARY.value))
<class 'int'>
>>>
>>>
>>>
>>> import pymssql
KeyboardInterrupt
>>> from enum import Enum
>>>
>>>
>>> print(isinstance(pymssql.BINARY, Enum))
False
>>> print(type(pymssql.BINARY))
<class 'pymssql._pymssql.DBAPIType'>
>>>
>>>
>>> print(hasattr(pymssql.BINARY, "value"))
True
>>>
>>>
>>> exit()
root@6df56b1b55c6:/opt/airflow# pip install pymssql==2.3.4
Collecting pymssql==2.3.4
  Using cached pymssql-2.3.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (4.5 kB)
Using cached pymssql-2.3.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB)
Installing collected packages: pymssql
  Attempting uninstall: pymssql
    Found existing installation: pymssql 2.3.2
    Uninstalling pymssql-2.3.2:
      Successfully uninstalled pymssql-2.3.2
Successfully installed pymssql-2.3.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
root@6df56b1b55c6:/opt/airflow# python
Python 3.9.21 (main, Mar 18 2025, 00:53:02)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>> print(hasattr(pymssql.BINARY, "value"))
True
>>> print(type(pymssql.BINARY.value))
<class 'int'>

Telling mypy to ignore it.


^ 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 airflow-core/newsfragments.

@potiuk potiuk merged commit 5c12dd6 into apache:main Apr 2, 2025
17 checks passed
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
diogotrodrigues pushed a commit to diogotrodrigues/airflow that referenced this pull request Apr 6, 2025
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
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.

2 participants