Skip to content

Commit 4bbca37

Browse files
committed
add support for the inspector
1 parent de9328a commit 4bbca37

File tree

1 file changed

+13
-0
lines changed
  • extensions/positron-python/python_files/posit/positron

1 file changed

+13
-0
lines changed

extensions/positron-python/python_files/posit/positron/inspectors.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,18 @@ def _is_active(self, value) -> bool:
12481248
return True
12491249

12501250

1251+
class RedshiftConnectionInspector(BaseConnectionInspector):
1252+
CLASS_QNAME = ("redshift_connector.Connection", "redshift_connector.core.Connection")
1253+
1254+
def _is_active(self, value) -> bool:
1255+
try:
1256+
# a connection is active if you can acquire a cursor from it
1257+
value.cursor()
1258+
except Exception:
1259+
return False
1260+
return True
1261+
1262+
12511263
class IbisExprInspector(PositronInspector["ibis.Expr"]):
12521264
def has_children(self) -> bool:
12531265
return False
@@ -1290,6 +1302,7 @@ def to_plaintext(self) -> str:
12901302
**dict.fromkeys(SnowflakeConnectionInspector.CLASS_QNAME, SnowflakeConnectionInspector),
12911303
**dict.fromkeys(DatabricksConnectionInspector.CLASS_QNAME, DatabricksConnectionInspector),
12921304
**dict.fromkeys(BigQueryConnectionInspector.CLASS_QNAME, BigQueryConnectionInspector),
1305+
**dict.fromkeys(RedshiftConnectionInspector.CLASS_QNAME, RedshiftConnectionInspector),
12931306
"ibis.Expr": IbisExprInspector,
12941307
"boolean": BooleanInspector,
12951308
"bytes": BytesInspector,

0 commit comments

Comments
 (0)