Skip to main content

Module convert

Module convert 

Source
Expand description

Type-aware conversion from Snowflake SQL REST API rows to JSON objects.

The Snowflake SQL REST API returns every cell as a string, regardless of its column type, and ships a schema (resultSetMetaData.rowType) alongside the rows. This module pairs each cell with its column metadata and produces a serde_json::Value::Object per row.

Type coverage (Snowflake’s type field is lowercase in the JSON v2 format):

Snowflake typeJSON output
fixed, scale 0Number (i64/u64 if it fits, else String — full precision)
fixed, scale > 0String (exact decimal — full precision preserved)
realNumber (f64)
booleanBool
text / binaryString
date / time / timestamp_*String (ISO/Unix-seconds as-is)
variant / object / arrayparsed JSON value (falls back to String)
anything elseString (raw cell)

null cells map to Value::Null regardless of declared type.

Structs§

ColumnMeta
One entry in resultSetMetaData.rowType. Only the fields we actually use are deserialised; everything else is ignored.

Functions§

row_to_json
Build a JSON object out of one Snowflake row (an array of string cells).