Skip to main content

Export Parquet

info

Parquet export writes the results of one read-only query to a single Parquet file for later reading and analysis. The file remains on the actual execution host. Verify by reading the final file and checking its content. File existence or a growing .part does not establish completion.

Where to operate: taosExplorer → Data Publishing → Parquet, or taosx run on the command line. Confirm the source query in the taosExplorer Data Browser or taos CLI and verify file content with a standard Parquet reader.

A service task's file is on the taosX service host that actually executes the export. A CLI file is on the command execution host, not in the browser download directory. Execution through taosX-Agent or VIA is currently unsupported.

1. Prepare the Query and Output Directory​

ItemPrerequisite
Source connectionThe export host can reach source taosAdapter. The query identity can read the selected database, tables, and fields.
QueryOne read-only query has been verified in the taosExplorer Data Browser or taos CLI, with time range, row count, fields, types, and nulls defined.
Output locationA directory writable by the taosX service or taosx run identity, with sufficient space. Default no-overwrite mode also requires a filesystem supporting same-directory hard links and permission for that identity to create them. File retrieval personnel know the actual execution node.
Verification toolA tool that reads Parquet. The Python check on this page requires Python and pyarrow already installed on the verification host.

First have an authorized TDengine TSDB administrator confirm the query account can read the selected data. Run the planned export query in the taosExplorer Data Browser or taos CLI and define objects, fields, time window, and expected rows. Only one read-only SELECT or WITH ... SELECT is supported. SHOW, DESCRIBE, writes, and schema changes are unsupported.

Initially use SELECT 1 AS sample_value, which reads no business table, to check the entry point and path. Then replace it with a verified small business query. The output directory must exist, be writable, and have enough space. Filenames must end in .parquet. Do not choose a filename still in use.

2. Minimal GUI Export​

  1. Add a Parquet publishing task and enter the source TDengine DSN. Its host is source taosAdapter; the example port is 6041.
  2. Set SQL to SELECT 1 AS sample_value.
  3. Enter an absolute output path on the taosX service host, such as C:/taosx-export/sample-001.parquet on Windows or /var/tmp/taosx-export/sample-001.parquet on Linux. Prepare each directory on its corresponding service host.
  4. Keep overwrite off, explicitly select compression zstd, and retain Row Group size 131072 or use an allowed value below.
  5. Submit, start, and wait for completion. Have personnel with file-read permissions retrieve and verify the file on the service host.

3. CLI Examples and Parameters​

This isolated exercise requires taosX on the command host, a test taosAdapter at 127.0.0.1:6041, and unchanged initial account root with password taosdata. For changed passwords or remote instances, use the actual read-only identity and address. Never use example credentials in production. Both platform examples create a new temporary output directory without overwriting previous results.

Run in Bash on the command execution host:

output_dir=$(mktemp -d "${TMPDIR:-/tmp}/taosx-parquet.XXXXXX") || exit 1
taosx run -f 'taos+ws://root:taosdata@127.0.0.1:6041?query=SELECT%201%20AS%20sample_value' -t "parquet:$output_dir/sample.parquet?overwrite=false&compression=zstd&row_group_size=1024"
export_status=$?
printf 'exit=%s output=%s\n' "$export_status" "$output_dir/sample.parquet"
[ "$export_status" -eq 0 ] || exit "$export_status"
ls -l "$output_dir/sample.parquet"

Check exit code 0 first, then content. The example directory is temporary storage on the command host, not a remote database directory. URL-encode query SQL before placing it in DSN query. Properly encode spaces, &, quotes, and other characters in business queries too.

ParameterDefault and meaning
overwriteOff by default. When enabled, successfully generating a new file replaces the old final file; it does not append.
compressionDefault uncompressed; supports zstd, snappy, gzip, brotli, and lz4_raw.
compression_levelOptional integer: zstd 1–22, gzip 0–9, brotli 0–11. If omitted, use the compression library's default level. uncompressed, snappy, and lz4_raw do not accept it.
row_group_sizeMaximum rows per Row Group; default 131072, range 1024–10000000. Not the target file's total row count.

See Parquet Export Parameters for types, nulls, and applicability. These are target --to parameters. Read-side projection and batch_size are not equivalent settings. Omit unneeded parameters; empty strings such as overwrite= or compression= do not mean defaults.

For service tasks, relative paths resolve against task data directory ${data_dir}/tasks/<任务 ID>/<子任务 ID>/. Use absolute paths initially to avoid confusing service working directories with browser or terminal directories.

For example, after confirming downstream zstd support, change the output DSN parameter portion to compression=zstd&compression_level=3&row_group_size=131072&overwrite=false. Parameter names and values are case-sensitive. Do not substitute lz4 for lz4_raw. Higher compression levels can increase CPU use and export time. Choose based on actual data and downstream reads, not the highest level as a production default.

4. Confirm Completion and Read Content​

Export first writes <文件名>.part in the same directory, then creates the final file after successfully closing it and reading metadata. A .part file existing or growing does not make it deliverable. Size can also temporarily stop growing while a Row Group remains buffered. Do not restart based only on this.

warning

With overwrite off, either an existing final file or a same-named .part prevents export. Enabling overwrite deletes the existing same-named .part during preparation. After the new file completes, the old final file is deleted before replacement is attempted. If replacement fails, the old result is not guaranteed to remain. This is not atomic overwrite or rollback protection. Preserve old files first; favor new filenames for initial runs and retries. Do not delete temporary files belonging to other running tasks.

Default no-overwrite mode places the final file through a same-directory hard link. The output filesystem must support and permit it. A writable directory alone is insufficient. For network shares or removable media, first export a small sample in the planned directory using the actual runtime identity. If final placement fails, do not repeatedly rename paths within the same filesystem or enable overwrite merely to bypass the limitation.

Smaller Row Groups can flush temporary files more often but may reduce compression and add metadata overhead. Measure with defaults and representative queries before adjusting. More frequent file growth does not mean faster export.

Read the final file with an installed standard Parquet tool and check schema, row count, and values. If Python and pyarrow are already installed on the verification host, run this cross-platform check. Set PARQUET_FILE to the new final path, not the .part:

from pathlib import Path
import pyarrow.parquet as parquet

parquet_file = Path("<PARQUET_FILE>")
result = parquet.read_table(parquet_file)
print(result.schema)
print(result.num_rows)
print(result.to_pylist())
assert result.num_rows == 1
assert result.column("sample_value").to_pylist() == [1]

Expect one row with column sample_value equal to 1. Without such tools, have the file verifier perform equivalent checks in an available Parquet reader. File existence, correct extension, or correct header/footer markers do not replace content verification. For business exports, also compare row counts, time boundaries, fields, and nulls within the same stable window.

4.1 Verify UTC timestamp semantics​

According to the v3.4.4.2 release notes, timestamps in newly exported taosX Parquet files carry UTC semantics while retaining the source time precision and numeric values. The fix changes the time-zone annotation in the schema; it does not add or subtract a time offset from the values. For older versions, confirm whether the delivered version includes this change. Existing files are not automatically rewritten.

Verify business timestamps separately using the same known instant:

  1. Confirm a known source record, for example 2026-11-20T00:00:00Z, whose millisecond value is 1795132800000. Record the time precision, then export a small query range containing that row.
  2. Inspect the final file's schema with a standard reader. Arrow timestamps should have tz=UTC; the Parquet logical type should have isAdjustedToUTC=true, with a time unit matching the source precision.
  3. Compare file and source values in the same unit. The instant above remains 1795132800000 at millisecond precision. Then display it in UTC and verify the same instant. Do not manually add or subtract 8 hours merely because a reader displays local time.

5. Troubleshooting​

SymptomNext action
SQL rejectedConfirm a single read-only query and run the same SQL in the taosExplorer Data Browser or taos CLI first.
File not foundCheck execution node and service/CLI output path, not the browser download directory first.
Only .part appearsCheck task logs, disk, permissions, and query status. It is still being generated or failed; do not rename it for delivery.
Existing file causes failureCheck ownership of both final and same-named .part files. Prefer a new path. Enable overwrite only after preserving old results and explicitly permitting replacement.
Failed to promote Parquet output without overwritePreserve the completed .part and full error. Check filesystem hard-link support and runtime permissions. Re-export to a new path in a supported directory. Do not rename for delivery or enable overwrite to bypass the issue.
Downstream cannot read the fileCheck completion state, standard-reader errors, and field types, not only size.

Retrieve service logs and metrics through Logs and Performance, then locate the query, write, close, and completion phases in task logs.

5.1 Inspect Export Progress and Duration​

For service tasks, find the original Parquet task in taosExplorer Data Publishing and inspect its activities. Correlate these phases within the same task and run. Short tasks may lack intermediate progress records; not every message is required to appear:

Activity keywordPhase reached and next action
Starting Parquet export queryQuery started. If no later record appears for a long time, check source SQL, source connection, and database load.
Fetching first block for schema inferenceQuery returned; waiting for first results. If stalled, check source-result reads and errors rather than assuming target disk failure first.
Parquet export received first result blockFirst results received; not all query results are necessarily complete.
Parquet export progressProcessed rows, batches, and current file bytes. Rows growing without bytes can reflect Row Group buffering.
Parquet writer closedFile writing closed. Wait for final placement and completion; do not deliver .part.
Parquet export completedThis export finished. Record total rows, batches, final bytes, and duration. Still read and verify the final file.
Parquet export failed or Parquet export cancelledThis run failed or was canceled. Preserve the full reason and old files, then rerun under a new output name.

Standalone taosx run has no service activity list. Retain this command's output, exit code, and final-file checks; do not look for same-named activities in other tasks. Historical monitoring can miss intermediate states for short tasks.

To compare processed rows, file size, and write/close durations, query actual monitoring tables as described in Inspect and Interpret Parquet Metrics. Check metric meanings, objects, and sample times first. The latest write duration is not total query duration, and cumulative output rows do not prove this run's file is complete.

For other task, write, and runtime issues, see Troubleshooting by Symptom.

6. Stop and Rerun​

Stop service tasks in the list or foreground CLI with Ctrl+C. After failure or stopping, reruns query from the beginning rather than append to existing .part. Retain logs and old files first and retry with a new output name. Source data may change between queries, so record the comparison window again.

7. Limitations​

Directory output, multifile splitting, and appending are unsupported. The current task page provides no file download or estimate of total rows, size, or remaining time. The file contains query results only, not all schema, permissions, and state needed for complete database restoration. It is not a database backup.