@@ -38,17 +38,18 @@ def query_result(
3838 )
3939 else :
4040 trunc = None
41+ meta = result .metadata_dict ()
4142 meta_bits = []
42- if result . result_id :
43- meta_bits .append (f"**result_id** `{ result . result_id } `" )
44- if result . query_run_id :
45- meta_bits .append (f"**query_run_id** `{ result . query_run_id } `" )
46- if result . execution_time_ms is not None :
47- meta_bits .append (f"**execution_time_ms** { result . execution_time_ms } " )
48- if result . warning :
49- meta_bits .append (f"**warning** { result . warning } " )
50- if result . error_message :
51- meta_bits .append (f"**error** { result . error_message } " )
43+ if meta [ " result_id" ] :
44+ meta_bits .append (f"**result_id** `{ meta [ ' result_id' ] } `" )
45+ if meta [ " query_run_id" ] :
46+ meta_bits .append (f"**query_run_id** `{ meta [ ' query_run_id' ] } `" )
47+ if meta [ " execution_time_ms" ] is not None :
48+ meta_bits .append (f"**execution_time_ms** { meta [ ' execution_time_ms' ] } " )
49+ if meta [ " warning" ] :
50+ meta_bits .append (f"**warning** { meta [ ' warning' ] } " )
51+ if meta [ " error_message" ] :
52+ meta_bits .append (f"**error** { meta [ ' error_message' ] } " )
5253 header = mo .md (" · " .join (meta_bits ) if meta_bits else "_No metadata._" )
5354 df = result .to_pandas ()
5455 tbl = mo .ui .table (
@@ -70,10 +71,9 @@ def query_result(
7071class RecentResults :
7172 def __init__ (self , client : HotdataClient , * , limit : int = 50 ) -> None :
7273 self ._client = client
73- listing = client .results ().list_results (limit = limit , offset = 0 )
74- self ._results = listing .results
74+ self ._results = client .list_recent_results (limit = limit , offset = 0 )
7575 option_pairs = [
76- (f"{ r .created_at } · { r .status } · { r .id } " , r .id )
76+ (f"{ r .created_at } · { r .status } · { r .result_id } " , r .result_id )
7777 for r in self ._results
7878 ]
7979 options = _option_map_with_unique_labels (option_pairs )
@@ -110,20 +110,19 @@ def run_history(
110110 limit : int = 20 ,
111111 label : str = "Run history" ,
112112):
113- runs = client .query_runs (). list_query_runs ( limit = limit ). query_runs
113+ runs = client .list_run_history ( limit = limit )
114114 if not runs :
115115 return mo .md ("_No query runs returned._" )
116116
117117 rows : list [dict [str , object ]] = []
118118 for r in runs :
119119 rows .append (
120120 {
121- "created_at" : getattr (r , "created_at" , None ),
122- "status" : getattr (r , "status" , None ),
123- "execution_time_ms" : getattr (r , "execution_time_ms" , None ),
124- "result_id" : getattr (r , "result_id" , None ),
125- "query_run_id" : getattr (r , "id" , None )
126- or getattr (r , "query_run_id" , None ),
121+ "created_at" : r .created_at ,
122+ "status" : r .status ,
123+ "execution_time_ms" : r .execution_time_ms ,
124+ "result_id" : r .result_id ,
125+ "query_run_id" : r .query_run_id ,
127126 }
128127 )
129128
0 commit comments