Type TAllowedParameterValue more completely

オープン
#669 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
database

調査の方向性

issue でリンクされている TAllowedParameterValue の定義がある src/databricks/sql/parameters/native.py から始めます。再帰的なアノテーションを作成する前に、コネクタが受け付けるパラメータの形状を確認し、その後 sql_params_dict を使用する wrapper でプロジェクトの厳格な pyright チェックを実行します。リスト、dict、タプルのサポート対象の値が、部分的に不明な型のエラーなしですべて型付けされていれば完了です。

索引モデルが 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分
マージ済み PR(30日)
10

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

databricks/databricks-sql-python のほかの issue

databricks/databricks-sql-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。