Use DbApiHook.run for DbApiHook.get_records and DbApiHook.get_first#26944
Use DbApiHook.run for DbApiHook.get_records and DbApiHook.get_first#26944potiuk merged 1 commit intoapache:mainfrom
Conversation
f020eda to
a1a3296
Compare
196fbe7 to
b07bff8
Compare
22e1744 to
81cb45f
Compare
There was a problem hiding this comment.
I think that should also remove the # type: ignore[override] in subcleases?
There was a problem hiding this comment.
I changed back from sql: str = "" to sql: str | list[str] = "".
It seems strange but without it, I can't remove # type: ignore[override]
81cb45f to
bb0b5bf
Compare
bb0b5bf to
4acb783
Compare
|
@potiuk - looks like this PR breaks get_first and get_records return type for snowflake for example , so instead of tuple we get a Dict. this code - was getting the default cursor from the connection ( |
|
Use latest version of both Airflow and Snowflake provider. There were several fixes implemented after that one. Just make sure to upgrade everything to latest versions as they contain latest fixes. |
|
And make sure to fix any deprecation warnings you see and look at the release notes - of Snowflake provider. There were a few breaking changes that you might want to fix (some of the things could be one of them). |
|
@potiuk - thanks , i kinda figure that out after trying to play with different versions of common-sql and provider. |
No. It is actually common right now. We use to have mess in the PAST . Now it's all straightforward. And the "other" options (like Dictionary) are only for those who want to have backwards compatibility. Mess is mainly because user want to stick to old ways even if we make things better organized and prefer to stay with the messy way it was before. |
|
So if you want to avoid the mess - convert your code to use tuples and you will be good and everything will be straightend u for you (as is for users who are starting now and everything is the same for all DBAPi Hooks) Also if you want to know why - you can read more of the architectural decisions made here: #36015 They explain how we straightened up the mess. |
|
@potiuk - i think i came out wrong - i really appreciate what have being done (sticking with standard DBAPI) anyway - i'm trying to use the latest and greatest , in addition i'm using astronomer async operators - but now |
|
Not suure - might be problem with the async operators |
Currently
DbApiHook.get_recordsandDbApiHook.get_firstinvokescursor.executemethod.This PR is a step to possibly use a single method
DbApiHook.runfor query execution.closes: #9957