File tree Expand file tree Collapse file tree
src/query_farm_server_base Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -465,6 +465,32 @@ def sql(self) -> str:
465465 )
466466
467467
468+ class SerializedValueType_timestamp (BaseModel ):
469+ id : Literal ["TIMESTAMP" ] = "TIMESTAMP"
470+ type_info : None
471+
472+ def sql (self ) -> str :
473+ return self .id
474+
475+
476+ class SerializedValue_timestamp (SerializedValueBase ):
477+ type : SerializedValueType_timestamp
478+ value : int | None = None
479+
480+ def sql (self ) -> str :
481+ if self .is_null :
482+ return "null"
483+ assert self .value
484+
485+ return (
486+ "TIMESTAMP '"
487+ + datetime .fromtimestamp (int (self .value ) / 1_000_000 , tz = UTC ).strftime (
488+ "%Y-%m-%d %H:%M:%S.%f"
489+ )
490+ + "'"
491+ )
492+
493+
468494class SerializedValueType_timestamp_ms (BaseModel ):
469495 id : Literal ["TIMESTAMP_MS" ] = "TIMESTAMP_MS"
470496 type_info : None
@@ -879,6 +905,7 @@ def sql(self) -> str:
879905 | Annotated [SerializedValue_struct , Tag ("STRUCT" )]
880906 | Annotated [SerializedValue_time , Tag ("TIME" )]
881907 | Annotated [SerializedValue_time_with_time_zone , Tag ("TIME WITH TIME ZONE" )]
908+ | Annotated [SerializedValue_timestamp , Tag ("TIMESTAMP" )]
882909 | Annotated [SerializedValue_timestamp_with_time_zone , Tag ("TIMESTAMP WITH TIME ZONE" )]
883910 | Annotated [SerializedValue_timestamp_ms , Tag ("TIMESTAMP_MS" )]
884911 | Annotated [SerializedValue_timestamp_ns , Tag ("TIMESTAMP_NS" )]
You can’t perform that action at this time.
0 commit comments