Metadata, parameters and exact values
JSON conventions for BIGINT, DECIMAL, dates, binary data, NULL and column origins.
Read columns_meta in column order
Each typed result provides column names and columns_meta in the same order, even with no matching rows. Types come from analysis and catalog metadata, not the first values. Pending packets are not result sets. nullable is true, false or null when unknown. args:[] means unknown or inapplicable, not zero length.
Direct columns may include catalog, schema, table and source_column. Calculated expressions get no invented origin. Expressions with unprovable static types may remain UNKNOWN; an explicit CAST clarifies the contract. Outer joins may make NOT NULL source columns nullable.
{"name":"Montant","type":"DECIMAL","args":[19,4],"nullable":true,
"catalog":"Atelier","schema":"dbo","table":"ventes","source_column":"montant"}Decode without losing precision
| Type | args | JSON value and Python decoding |
|---|---|---|
| BIT / TINYINT / SMALLINT / INT | [] | JSON integer; BIT follows 0/1. |
| BIGINT | [] | Decimal integer string; int(value). |
| DECIMAL / NUMERIC | [precision, scale] or [] | Exact string; Decimal(value), never float(value). |
| FLOAT / REAL | [] | Finite approximate JSON number. |
| CHAR / VARCHAR / NCHAR / NVARCHAR | [length] or [] | Unicode string; length is characters. |
| TEXT | [] | Unicode string; static length unknown. |
| BINARY / VARBINARY | [bytes] or [] | Lowercase hex without prefix; bytes.fromhex(value). |
| DATE | [] | YYYY-MM-DD. |
| TIME / DATETIME / DATETIME2 / DATETIMEOFFSET | [6] | ISO 8601; DATETIMEOFFSET retains its offset, without inventing a timezone. |
| TIMESTAMP | [] + source unit | Integer string, s/ms/us units; not SQL Server rowversion. |
| UNKNOWN | [] | Retain the representation or request a CAST. |
Send values and type NULL
For BIGINT above 2^53 and DECIMAL, send strings with parameter_types. Binary parameters use hex strings and BINARY/VARBINARY declarations. NULL is JSON null; an empty string is "". Accepted prepared types are advertised by capabilities; TIMESTAMP and UNKNOWN are excluded.
Dates/times retain up to six fractional digits. A shorter temporal declaration does not implement full SQL Server rounding: metadata reflects [6], with declared_args where necessary. SQL CAST to short text may shorten the value through SQL conversion; this is separate from transport truncation. Oversized prepared text parameters are rejected.
{"params":{"id":"9007199254740993","n":"123456789012345.6789","b":"00ff","x":null},
"parameter_types":{"id":{"type":"BIGINT"},"n":{"type":"DECIMAL","args":[19,4]},
"b":{"type":"VARBINARY","args":[16]},"x":{"type":"NVARCHAR","args":[80]}}}