Skip to main content

Object Selection and Renaming

info

Object selection determines what is read; renaming determines target names. Neither changes source objects. Query migration fixes scope with supertable or table lists; TMQ scope comes from topic definitions. An empty list is not an explicit empty set, and rule changes do not move objects already written.

Where to operate: object and transformation settings in TDengine Query or Data Subscription tasks. In CLI, select objects through the source DSN and configure transformation actions with taosx run -T.

Neither object selection nor renaming replaces source permission controls. Before migration, list source databases, supertables, child tables, target databases, and target names. Avoid renaming only child tables while overlooking supertable references or name conflicts across sources.

1. Fix the Object Set​

In query migration, source DSN stables=meters selects the supertable and its child tables; tables=meter_1 selects a specific table. Nonempty stables takes precedence over tables; they do not form an intersection. With sparse mode enabled, providing both valid lists causes an error. Use one explicit selection for the first test. Do not fill both lists expecting a narrower scope. See TDengine Query Migration for historical start and end settings.

warning

Inline lists containing an empty string, only whitespace, or only commas, and genuinely empty list files, do not specify an explicit empty object set. They may fall back to the other selection or enumerate the entire database. Do not clear fields to mean “read no tables this time.” To stop processing, stop the original task. See Query Source Parameters for full syntax and scope restrictions.

For many objects, a direct source DSN can reference a line-by-line list on the execution host with tables=@文件路径 or stables=@文件路径, optionally mixed with comma-separated inline names. This is not a two-column renaming CSV. Each file line is an object name; comments are not automatically recognized and leading/trailing whitespace is not trimmed. Check file content and the nonempty object list under actual permissions, then start a small task. A browser upload path is not necessarily readable by the service process.

TMQ scope comes first from topic definitions; see TMQ Continuous Synchronization. Do not add query migration's stables parameter directly to a subscription DSN expecting it to refilter an existing topic. Record the original topic and target objects before changing scope.

Query actual table lists, structures, and tags in the taosExplorer Data Browser or taos CLI and save redacted results. For many objects, verify a small representative set first. Whether new source tables are included automatically depends on the selected method and topic scope; one successful migration does not establish this behavior.

2. Minimal Renaming Example​

First prepare taosx_demo_src.meters and meter_1 as described in Migrate a Time Range with the CLI, keeping the target database separate. These commands add prefix copy_ to the supertable and src_ to the child table:

The exercise requires source and target in the same isolated test cluster, taosAdapter in the command execution environment, and unchanged default root / taosdata credentials. For actual deployment, substitute approved identities and addresses on both sides and encode reserved characters according to DSN rules. Do not use default accounts in production.

Run in Bash on a Linux command-line host that can reach both sides:

taosx run -f 'taos+ws://root:taosdata@127.0.0.1:6041/taosx_demo_src?stables=meters&mode=history&start=2026-11-20T00:00:00Z&end=2026-11-20T00:01:00Z' -t 'taos+ws://root:taosdata@127.0.0.1:6041/taosx_demo_dst' -T 'rename-super-table:prefix:copy_' -T 'rename-child-table:prefix:src_'

Expect target supertable copy_meters and child table src_meter_1. The child table still uses the renamed supertable structure. Run only against an isolated test target, checking first that the new names are unused.

3. Choose Transformation Rules​

Query migration and TMQ service tasks share Transformations. Expand this area, click Add Transformation Rule, choose a rule, and enter required values. After each addition, check its combined effect with existing rules. To delete a rule, operate only on that rule's row and retain the task.

The image below illustrates inputs for rule types. Fill example paths, prefixes, suffixes, and tag values according to the migration inventory. Adding every rule is not required:

Shared CSV, prefix/suffix, regex, and custom transformation rules for query migration and TMQ

GUI ruleRequired inputVerification focus
Rename supertables by CSV mappingUpload a headerless two-column mapping file, or supply the file reference supported by this entry point.Check both supertable names and child-table references. See the next section for files.
Rename tables by CSV mappingSupply source-to-target table-name mappings.List affected tables first. Do not use a supertable mapping file as a child-table list.
Add table-name prefixFor example, v1_.Check the full composed name, length, and uniqueness, not just whether the prefix appears.
Add table-name suffixFor example, _backup.Also check target objects and whether continuous data keeps using the name.
Rename tables by regexFormat: 正则表达式::替换文本, for example ^old(?<name>.*)$::new_$name.Test matching, nonmatching, boundary, and potentially colliding source names. Preserve capture-group syntax.
Custom ruleA complete, confirmed -T action, such as add-tag:location=beijing.The input is a transformation action, not SQL, a shell command, or a general parsing expression.

The fixed-tag example adds a location tag with value beijing. Check source object types, existing target tags, and permissions first to avoid conflicts with same-named tags. This action does not support dynamic tag templates; do not apply message-field-mapping expression syntax. Adding or removing transformation rules does not automatically move existing data between tables or repair tags. Initially operate only on isolated test objects.

3.1 CLI Actions and Rules​

ActionPurposeChecks
rename-super-tableRename a supertable and maintain related references.Supertable definition and child-table associations are correct.
rename-child-tableRename child tables.The same device or source object continuously enters the same target child table.
rename-tableApply rules to table names.Determine affected table types first. Avoid repeated renaming with other actions.
prefix, suffixAdd a fixed prefix or suffix.Composed names are valid, within length limits, and do not conflict with existing objects.
templateUse a name template.Check generated results individually with actual table names first.
mapRename using an old-to-new name list.Headerless CSV, two columns per row, covering all expected objects.
replace_with_regexReplace according to matching rules.Positive and negative examples, unmatched names, and collision risks.

The table lists actions and rules required for renaming. See the reference for other taosx run -T uses; use add-tag above for fixed tags. Multiple actions jointly affect results. Start with a minimal combination, verify, then add more. Do not copy message parsing's t_{device} template unchanged into a migration table-name template.

Query migration target DSN remap is a separate column-name mapping mechanism, not a table-name transformation action. It takes three items: table name, source column, target column. The headerless two-column renaming file on this page cannot be used directly. See Target Column-Name Mapping for syntax, grouping order, and applicable paths. Verify both column names and data after migration, not just table-name changes.

4. Use a CSV Mapping File​

For example, a child-table list without a header:

meter_1,plant_a_meter_1
meter_2,plant_a_meter_2

For taosx run, prepare the file on the actual command execution host, readable by the execution account. Example argument:

-T "rename-child-table:map:@C:/taosx-config/rename-tables.csv"

A Linux path example is -T "rename-child-table:map:@/etc/taos/rename-tables.csv". Here @ means read a file; it is not part of the filename. Do not add old,new as a first row, or it will be treated as an actual mapping.

In the GUI, use the mapping-file upload control and check the selected file afterward. Do not enter a browser-host path as if the taosX service could read it directly. Maintain the file as normal configuration, without business credentials.

5. Verify Structure, Values, and Incremental Data​

Run in the target cluster's taosExplorer Data Browser or taos CLI:

DESCRIBE taosx_demo_dst.copy_meters;
SHOW taosx_demo_dst.TABLES;
SELECT ts, value, site FROM taosx_demo_dst.src_meter_1 ORDER BY ts;

Expect two historical rows with values 10.5 and 11.5, tagged lab. Check the child table's supertable and all target names, not just row counts. For continuous synchronization, also send a new timestamp and confirm that incremental data follows the same renaming rules. Verify required schema changes on isolated objects.

6. Troubleshooting and Recovery​

SymptomNext action
Mapping file cannot be readCheck the actual taosx run or service execution host, file delivery method, path, and account permissions.
Target exists or schema conflictsConfirm name collisions against the migration inventory. Do not delete business objects and retry.
Incorrect child-table associationCheck that supertable and child-table actions are paired correctly and no duplicate transformations exist.
New data enters another set of tablesCheck whether rules or source identifiers changed during recovery. Stop scope expansion and identify when routing diverged.

Retain the same rules, mapping files, and state when stopping and resuming the original task. Renaming-rule changes do not move objects already written. After rolling back configuration, also handle objects and data produced during the change. Backfill, table deletion, or rebuilding requires separate approval.

7. Limitations​

This page applies to ordinary query migration and subscription transformations, not dedicated replica dual-active tasks. Dual-active tasks do not accept PARSER or these transformations. Migrate users and permissions through separate security-management procedures, not table-name mapping lists.