File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,10 @@ def dune_result_to_df(result: ExecutionResult) -> TypedDataFrame:
225225 varbinary_cols .extend (_varbinary_cols )
226226 unknown_cols .extend (_unknown_cols )
227227
228- df = pd .DataFrame (result .rows )
228+ df = pd .DataFrame (result .rows , columns = metadata .column_names )
229+ if df .empty :
230+ return TypedDataFrame (df , dtypes )
231+
229232 df = _reformat_varbinary_columns (df , varbinary_cols )
230233 df = _reformat_unknown_columns (df , unknown_cols )
231234
Original file line number Diff line number Diff line change 4747 ],
4848 "metadata" : {
4949 "column_names" : [
50- "blocktime " ,
50+ "block_date " ,
5151 "block_number" ,
52- "success " ,
52+ "blocktime " ,
5353 "hash" ,
54+ "success" ,
5455 "type" ,
55- "block_date" ,
5656 "some_number" ,
5757 ],
5858 "column_types" : [
59- "timestamp with time zone " ,
59+ "date " ,
6060 "bigint" ,
61- "boolean " ,
61+ "timestamp with time zone " ,
6262 "varbinary" ,
63+ "boolean" ,
6364 "varchar" ,
64- "date" ,
6565 "decimal(12, 7)" ,
6666 ],
6767 "row_count" : 1 ,
@@ -133,6 +133,7 @@ def test_dune_results_to_db(self):
133133 "some_number" : [12.001 ],
134134 }
135135 )
136+ print (expected )
136137 self .assertIsNone (
137138 pandas .testing .assert_frame_equal (df , expected , check_dtype = True )
138139 )
You can’t perform that action at this time.
0 commit comments