File Export

The file-export command reads data from a Redis database and writes it to a file, potentially gzip-compressed.

Supported File Types

Type Extension Description

csv

.csv

Comma-separated values

tsv

.tsv

Tab-separated values

psv

.psv

Pipe-separated values

json

.json

JSON array

jsonl

.jsonl

JSON Lines (newline-delimited JSON)

xml

.xml

XML

parquet

.parquet

Apache Parquet

The general usage is:

riotx file-export [OPTIONS] FILE

To show the full usage, run:

riotx file-export --help

JSON

Export to JSON
riotx file-export myexport.json
Sample JSON-export file
[
 {"key":"gen:71","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"json","value":"{\"field1\":\"value1\",\"field2\":\"value2\"}"},
 {"key":"gen:83","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"hash","value":{"field1":"value1","field2":"value2"}},
 {"key":"gen:45","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"set","value":["1","2","3"]}
]
Export to compressed JSON
riotx file-export myexport.json.gz

JSON Lines

JSON Lines (also known as newline-delimited JSON) outputs each record on a separate line without the array wrapper. Use the .jsonl extension or specify --type jsonl.

Export to JSON Lines
riotx file-export myexport.jsonl
Sample JSON Lines export file
{"key":"gen:71","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"json","value":"{\"field1\":\"value1\",\"field2\":\"value2\"}"}
{"key":"gen:83","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"hash","value":{"field1":"value1","field2":"value2"}}
{"key":"gen:45","event":"scan","time":"2024-11-06T08:23:12.559Z","type":"set","value":["1","2","3"]}

XML

Export to XML
riotx file-export myexport.xml

CSV

Export to comma-separated values format.

Export to CSV
riotx file-export myexport.csv --content-type MAP

TSV (Tab-Separated Values)

Export to tab-separated values format. Use the .tsv extension or specify --type tsv.

Export to TSV
riotx file-export myexport.tsv --content-type MAP

PSV (Pipe-Separated Values)

Export to pipe-separated values format. Use the .psv extension or specify --type psv.

Export to PSV
riotx file-export myexport.psv --content-type MAP

Parquet

Parquet file export example
riotx file-export beers.parquet --parquet-field ounces=DOUBLE abv=DOUBLE id=INT32