The session attribute is set on the Connection here:
.
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.
Reactions are currently unavailable
The session attribute is set on the Connection here:
databricks-sql-python/src/databricks/sql/client.py
Line 296 in 9fe7356
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.