@terascope/data-mate / teal-frame/export-json
teal-frame/export-json
Interfaces
| Interface | Description |
|---|---|
| JsonExportOptions | How an export renders fields and nulls: DataFrame's SerializeOptions, with the same meaning, plus removeNullFields as a shorthand for two common presets. See resolveRules. |
Functions
buildJsonExpression()
buildJsonExpression(
config,options?):string
Defined in: data-mate/src/teal-frame/export-json.ts:510
A SQL expression producing one JSON string per row, byte-identical to DataFrame.toJSON with
the same options, or NULL for a row that skipEmptyObjects drops.
Two things are left to the caller: removing duplicate rows under skipDuplicateObjects,
which compares whole rendered rows in order and is done on the stream (TealFrame.ndjson),
and filtering rows, which uses buildJsonRowFilter.
Parameters
| Parameter | Type |
|---|---|
config | DataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>> |
options | JsonExportOptions |
Returns
string
buildJsonListElement()
buildJsonListElement(
config,column,options?):object
Defined in: data-mate/src/teal-frame/export-json.ts:445
SQL rendering one element of a LIST column, read from a column named v0 (for example an
unnest of the list), as ListVector.toJSONCompatibleValue renders it: NULL for a nil
element, which the caller keeps or skips.
Parameters
| Parameter | Type |
|---|---|
config | DataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>> |
column | string |
options | JsonExportOptions |
Returns
object
isObject
isObject:
boolean
sql
sql:
string
buildJsonRowFilter()
buildJsonRowFilter(
config,options?):string|undefined
Defined in: data-mate/src/teal-frame/export-json.ts:494
The predicate for the rows an export writes, or undefined when it writes all of them. It is separate from buildJsonExpression so the filter never evaluates the rendered row.
Parameters
| Parameter | Type |
|---|---|
config | DataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>> |
options | JsonExportOptions |
Returns
string | undefined
buildJsonValue()
buildJsonValue(
config,field,accessor?,options?):string
Defined in: data-mate/src/teal-frame/export-json.ts:471
SQL rendering one field's value as JSON text, exactly as buildJsonExpression renders it
inside a row: a Date as ISO 8601, a Long above 2^53 exactly, a geo point as {lat, lon}, a
Tuple as a list and an Object with the same nil rules. NULL for a nil value.
It is for SQL that needs a value as JSON, such as the variables of a template, where DuckDB's
own to_json would write the stored form (a Date's { ms, tz_offset } struct).
Parameters
| Parameter | Type | Description |
|---|---|---|
config | DataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>> | - |
field | string | a field of the config; a dotted path reaches into objects, not into a list |
accessor | string | the SQL reading the value; by default the column, or its member for a path |
options | JsonExportOptions | - |
Returns
string
resolveRules()
resolveRules(
options?):Rules
Defined in: data-mate/src/teal-frame/export-json.ts:170
Resolves the rules an export follows.
If any SerializeOptions flag is given, the flags mean exactly what they mean to
DataFrame.toJSON, and an unset flag is false. removeNullFields selects a preset that
explicit flags override. With neither, the default is the removeNullFields: true preset.
Parameters
| Parameter | Type |
|---|---|
options | JsonExportOptions |
Returns
Rules