mix threadline.export (Threadline v0.5.0)

Copy Markdown View Source

Loads application config, starts the configured Ecto repo, and writes an export file using Threadline.Exportno ad-hoc Ecto.Query in this task (parity with mix threadline.retention.purge).

Flags

  • --output PATH / -o — required when not using --dry-run (destination file). Do not paste production secrets into shell history; prefer argv from env files or wrappers for --actor-json payloads.
  • --formatcsv or json (default json when writing a file).
  • --json-formatwrapped (default) or ndjson (passed as json_format: to export).
  • --max-rows — forwarded as :max_rows (default from Threadline.Export).
  • --dry-run — counts matching rows via Threadline.Export.count_matching/2; does not write a file.
  • --table — optional table name filter (string), same as timeline/2 :table.
  • --from / --to — optional inclusive captured_at bounds as ISO-8601 UTC strings.
  • --actor-json PATH — optional UTF-8 file; contents decoded with Jason.decode!/1 and passed through Threadline.Semantics.ActorRef.from_map/1 as :actor_ref in filters.

Examples

mix threadline.export --dry-run --table users
mix threadline.export --format csv --output /tmp/audit.csv --table users
mix threadline.export --format json --json-format ndjson -o /tmp/lines.ndjson --max-rows 5000

Non-production: always review MIX_ENV, repo module, and printed counts before writing.