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
-
fix: inaccuracy ⚠️
难度 2/5 1-3 小时 新手友好度 72/100
uabrc/uabrc.github.io#1255 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
ethereum-optimism/factory#64 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
duckdb/duckdb-python#627 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
documentation
难度 1/5 1 小时以内 新手友好度 78/100
Qiskit/qiskit-addon-sqd#376 ·