File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,14 +52,12 @@ def connection_options(conns: list[Any]) -> dict[str, str]:
5252 )
5353
5454
55- def connection_picker (
56- client : HotdataClient ,
55+ def connection_picker_from_connections (
56+ conns : list [ Any ] ,
5757 * ,
5858 label : str = "Connection" ,
5959 full_width : bool = True ,
6060):
61- listing = client .connections ().list_connections ()
62- conns = listing .connections
6361 if not conns :
6462 return empty_dropdown (
6563 label = label ,
@@ -73,17 +71,37 @@ def connection_picker(
7371 )
7472
7573
74+ def connection_picker (
75+ client : HotdataClient ,
76+ * ,
77+ label : str = "Connection" ,
78+ full_width : bool = True ,
79+ ):
80+ conns = client .connections ().list_connections ().connections
81+ return connection_picker_from_connections (
82+ conns ,
83+ label = label ,
84+ full_width = full_width ,
85+ )
86+
87+
7688def resolve_connection_picker (
7789 client : HotdataClient ,
7890 * ,
7991 label : str = "Connection" ,
8092 full_width : bool = True ,
8193) -> tuple [Any | None , str | None ]:
8294 """Return ``(dropdown_or_none, implicit_connection_id)`` for table browsers."""
83- listing = client .connections ().list_connections ()
84- conns = listing .connections
95+ conns = client .connections ().list_connections ().connections
8596 if not conns :
8697 return None , ""
8798 if len (conns ) == 1 :
8899 return None , conns [0 ].id
89- return connection_picker (client , label = label , full_width = full_width ), None
100+ return (
101+ connection_picker_from_connections (
102+ conns ,
103+ label = label ,
104+ full_width = full_width ,
105+ ),
106+ None ,
107+ )
You can’t perform that action at this time.
0 commit comments