Type TAllowedParameterValue more completely
還沒有人認領這個 Issue。
評估
研究方向
從 issue 中連結的 src/databricks/sql/parameters/native.py 裡的 TAllowedParameterValue 定義開始。在建立遞迴註解之前,先檢查 connector 接受的參數形狀,然後使用一個採用 sql_params_dict 的 wrapper 執行專案嚴格的 pyright 檢查。完成的標準是:支援的 list、dict 和 tuple 值都已完整型別化,且沒有 partially unknown 錯誤。
由索引模型根據 Issue 內容生成。
描述
Currently, the type definition of TAllowedParameterValue is
TAllowedParameterValue = Union[
str,
int,
float,
datetime.datetime,
datetime.date,
bool,
decimal.Decimal,
None,
list,
dict,
tuple,
]
list, dict, and tuple are incomplete types. That means when I try to write a wrapper function around cursor.execute using that type as the type of a parameter sql_params_dict, pyright strict yells at me Type of parameter "sql_params_dict" is partially unknown.
I think this can easily be fixed. My guess is, this could simply be a recursive type definition, and those last three lines could be changed to
list[TAllowedParameterValue],
dict[TAllowedParameterValue, TAllowedParameterValue],
tuple[TAllowedParameterValue, ...]
]
However, there may be more or fewer restrictions on those types. I didn't look into it very hard.
- 主要語言
- Python
- 星號
- 233
- 分支
- 152
- 平均合併
- 21 小時 5 分鐘
- 30 天內合併 PR
- 10
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
databricks/databricks-sql-python 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 76/100
-
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 84/100
查看 databricks/databricks-sql-python 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
canonical/paas-charm#368 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
tech debt
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 1/5 1 小時以內 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
難度 1/5 1 小時以內 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·