Can not cognize type of model's real type in mypy #40619
Replies: 5 comments 2 replies
-
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval. |
Beta Was this translation helpful? Give feedback.
-
I think it's a very good issue - but you should likely open it in sqlalchemy repo. |
Beta Was this translation helpful? Give feedback.
-
Hi, @potiuk. First of all, thank you for your comment :) I also tested further and found that the error was raised when the Airflow version changed from
I apologize for not being well-versed in SQLAlchemy, and I would appreciate it if you could share your opinion. |
Beta Was this translation helpful? Give feedback.
-
Well. The community explicitly specified in our documentation that Airflow DB models ARE NOT a part of public interface of Airflow - https://airflow.apache.org/docs/apache-airflow/stable/public-airflow-interface.html#what-is-not-part-of-the-public-interface-of-apache-airflow so if you decide to use them directly, you are pretty much on your own to solve your problems. Our CI verify with mypy all the usages of sqlalchemy for Airflow, so this is fine. But if you decided to do somethin with SQLAlchemy models on your own - against the advices we gave at the "Public interface" then if something does not work for you, you won't get much help from Airflow maintainers (we specifically mentioned that so that we do not have to loose our time on solving similar issues). My recommendation is to stop modifying Airflow models (becasue they are internal detail of Airflow) and find other ways to achieve whatever you want to achieve - Airflow 3 will likely have HUGE changes to the database, including likely rewriting some of the base models, so you should not rely on thos models to continue working as they are. If you chose to work with SQL Alchemy models directly, you need to become expert in that - this is noit something you will get a lot of help here, this is why I suggested asking this question in SQLAlachemy forums. |
Beta Was this translation helpful? Give feedback.
-
@potiuk |
Beta Was this translation helpful? Give feedback.
-
Apache Airflow version
Other Airflow 2 version (please specify below)
If "Other Airflow 2 version" selected, which one?
2.9.0
What happened?
This code makes
Incompatible types
error after updating to Airflow2.7.0
from2.6.3
.I used
sqlalchemy2-stubs==0.0.2a38
andmypy==1.5.0
in both versions. And I also use python3.10.14What you think should happen instead?
No response
How to reproduce
1. install airflow
2. install mypy and sqlalchemy2-stubs
3. copy mypy.ini
4. copy code
5. run mypy
Operating System
macOS Ventura: 13.0.1 (22A400)
Versions of Apache Airflow Providers
No response
Deployment
Other
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions