Session is not set in object if connection fails, which raises 'AttributeError' on __del__

オープン 初心者向け
#746 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python
領域
databases

調査の方向性

src/databricks/sql/client.py の296行目付近から始め、Connection.del と初期化に失敗した場合の経路を調べます。無効なホストまたは認証情報で接続失敗を再現し、その後、不完全な Connection を破棄しても stderr に AttributeError 警告が出力されないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

engineer-bot

The session attribute is set on the Connection here: https://github.com/databricks/databricks-sql-python/blob/9fe7356a18d611ae18943c2f972160657b08eea2/src/databricks/sql/client.py#L296.

If connecting fails (e.g. due to invalid host or credentials) then no session attribute will be set, but __del__ will still be called when the not-fully-initialized Connection instance is destroyed. This causes warnings to be printed to stderr.

A simple fix would be to check if session is set in open or doing the same thing in __del__ only, to keep the semantics of open intact.

主要言語
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 を短くまとめたダイジェスト。