PI model configuration files
A model CSV maps filtered PI objects to TDengine supertables, child tables, columns, and tags. This page explains how to review the block structure, change mappings, and verify uploaded results. First confirm the source object scope in PI dataset filtering.
Entry point: taosExplorer → Data Ingestion → PI or PI backfill → Data Model Configuration → Download Default Configuration or Upload Configuration File.
Model files use a block-based CSV format. Different record types may have different numbers of columns. Keep the original download before editing, and use a UTF-8 text editor to prevent spreadsheet software from converting dates, Point names, or long IDs. A download for an existing task may reuse the saved model. Check the file contents; another download or a changed file modification time is not proof of a new scan.
For DSN use, production tasks must explicitly configure model and the unprefixed transform_config_file. The file must be readable on the actual execution host by the service identity. Omitting the model during scanning, or accepting prefixed names during file validation, does not mean these settings can be omitted from a production task. Do not use Base64 content or a remote URL as the file path. For complete conditions, see PI model and filter parameters.
1. Choose a model
| Model | Source requirements | Target granularity | Review focus |
|---|---|---|---|
| Single-column | Data Archive Only or AF mode | One child table per Point, with separate value and status columns | Point mappings, source types, UOM, and Point name templates. |
| Multi-column | AF Server and actual elements/attributes | One child table per AF element, with multiple PI Point attributes written to different columns | Element templates, element_id, value/status columns for each attribute, and static attribute tags. |
Default supertable naming for the single-column model depends on the entry point:
| Entry point | Default naming and review |
|---|---|
| Data Archive Only | The default scan does not provide UOM and generates ts_<类型小写> by source type. A Point having engineering units does not mean tables are separated by units by default. |
| AF single-column | When a UOM string exists, its letters are lowercased and characters other than ASCII letters and digits are replaced with underscores, then the result is combined with the type. Without UOM, ts_<类型小写> is used. Check empty units and duplicate normalized names. |
The definitions and mappings in the downloaded file are authoritative. When separating tables by business category or unit, maintain both definitions and Point mappings. Multi-column mode treats PI Point attributes as data columns and other static attributes as tags by default. A missing attribute on an element is different from an attribute with an empty value.
2. Supertable blocks and mapping records
Separate blocks with blank lines. One file can define multiple supertables.
| Row format | Meaning | Requirement |
|---|---|---|
SuperTable,名称 | Declare a target supertable | Update references after renaming. |
SubTable,模板 | Target child-table name | Single-column mode can use ${point_name}; multi-column mode can use ${element_name}_${element_id}. |
Template,模板名 | AF template source | Use an actual template; a matching string does not create AF objects. |
Filter,表达式 | Record filtering for this block | Empty means no additional expression; this is not dataset filtering. |
列名,KEY,TIMESTAMP,映射 | Timestamp primary key | Each supertable block must contain exactly one KEY of type TIMESTAMP. |
列名,COLUMN,类型,映射 | Data column | Configure values and quality status separately. |
列名,TAG,类型,映射 | Tag column | Match type and length to attribute values; multi-column mode must retain element_id. |
Point名称,POINT,超级表名 | Single-column mapping | The Point must exist, be readable, and reference a defined supertable. |
元素名称,ELEMENT,超级表名,元素ID[,路径] | Multi-column element record | Retain the actual downloaded IDs, paths, and mappings; brackets only indicate an optional path and are not file content. |
Downloaded multi-column files may contain actual element records. Do not keep only the Template row and guess the element scope. When collecting by template, a production task may include all template instances. For scope review, see Multi-column templates and collection scope.
3. Single-column model
The following model writes meter voltage and current to supertables for their respective units. Replace the Points with actual readable objects, and adjust column types to match the source types:
SuperTable,volt_float32
SubTable,${point_name}
Filter,
ts,KEY,TIMESTAMP,$ts
value,COLUMN,FLOAT,$value
status,COLUMN,INT,$status
point_name,TAG,VARCHAR(100),$point_name
engunits,TAG,VARCHAR(100),$engunits
descriptor,TAG,VARCHAR(100),$descriptor
SuperTable,milliampere_float32
SubTable,${point_name}
Filter,
ts,KEY,TIMESTAMP,$ts
value,COLUMN,FLOAT,$value
status,COLUMN,INT,$status
point_name,TAG,VARCHAR(100),$point_name
engunits,TAG,VARCHAR(100),$engunits
descriptor,TAG,VARCHAR(100),$descriptor
Meter_001_Voltage,POINT,volt_float32
Meter_001_Current,POINT,milliampere_float32
The blocks have the same structure but different dimensions. A current Point must not reference the voltage table. The default download may also include metadata such as path, ptclassname, sourcetag, tag, exdesc, pointsource, step, and future. Retain source identifiers as needed for retrieval.
AF single-column mode can include element_paths, for example:
element_paths,TAG,VARCHAR(512),`$element_paths.replace("\\", ".")`
The content inside backticks is a PI model mapping expression, not SQL, and does not follow standard CSV double-quote escaping rules. Retain the downloaded format and verify it with a small dataset.
3.1 Full-metadata download example
Download the single-column configuration with full metadata. This example retains the full tags for two units and six Point mappings for field review. Do not concatenate it with the blocks of the same names above.
path,point_name,sourcetag,tag, andptclassnameretain source information.descriptor,exdesc, andengunitsstore the description, extended description, and units, respectively. Checkpointsource,step, andfutureagainst source metadata.- The
element_pathsexpression replaces backslashes with periods. Do not assume this field exists when Data Archive Only does not provide AF metadata.VARCHAR(512)does not guarantee lossless storage of paths of arbitrary depth either.
4. Multi-column model
Assuming AF contains MeterTemplate with voltage and current attributes, a representative model block is:
SuperTable,metertemplate
SubTable,${element_name}_${element_id}
Template,MeterTemplate
Filter,
ts,KEY,TIMESTAMP,$ts
voltage,COLUMN,DOUBLE,$voltage
voltage_status,COLUMN,INT,$voltage_status
current,COLUMN,DOUBLE,$current
current_status,COLUMN,INT,$current_status
element_id,TAG,VARCHAR(100),$element_id
element_name,TAG,VARCHAR(100),$element_name
path,TAG,VARCHAR(200),$path
categories,TAG,VARCHAR(100),$categories
This block explains only the structure and cannot replace the actual element list in the downloaded file. Attribute names must come from the source; taosX does not invent them. Check for duplicate normalized column names, especially source attributes that share names with fixed tags such as element_id.
4.1 Two-template download example
Download the MeterTemplate and Farm two-template configuration. This reference example is for reviewing multi-template structure. Farm contains five PI Point attributes and their respective status columns.
farm_lifetime_production__weekly_ and farm_lifetime_production__hourly_ are normalized field names. Retain consecutive underscores exactly as downloaded. The two templates use different example lengths for path; review the target types against actual paths. Template does not identify a specific element. Verify the actual scope using Multi-column templates and collection scope.
5. Mapping variables and expressions
| Syntax | Meaning | Applicable conditions |
|---|---|---|
$ts | Source event time | Single-column and multi-column. |
$value, $status | Point value and status | Single-column; multi-column usually uses the value and status fields for each attribute. |
$point_name, $engunits | Point name and engineering units | Actual Point metadata exists. |
$element_name, $element_id | AF element name and ID | AF multi-column. |
$path, $categories, $element_paths | Path, categories, and paths of elements associated with a Point | Choose according to the downloaded model and source mode; do not assume Data Archive Only includes AF metadata. |
$属性名 | Actual attribute value | Match the downloaded field name, and check the status column separately. |
| Expression inside backticks | Path or numeric transformation | Verify input, output, units, and types; do not copy SQL functions directly. |
${...} is used in child-table name templates, and $... is used in column mappings. The model Filter runs before column mapping and can use only input fields available before mapping, not target columns generated later. It also differs from the name wildcards in PI dataset filtering.
Do not apply custom mapping expressions to timestamp columns. Rewriting the ts mapping cannot be used to correct time zones or manufacture sample times. Some invalid expressions may not produce an upload or validation error. Check target fields and values against known input.
Single-column POINT records are split on ordinary commas. Do not assume that backtick or CSV double-quote rules for other records provide end-to-end support for Point names containing commas. For such names, confirm the delivery approach first. Do not alter the source names, URL-encode them, or substitute other Points.
6. Upload and verification
First limit the scope to one Point or AF element. After uploading, check the supertable, actual child-table name, time, value, status, and tags. Run the following in the taosExplorer Data Browser or taos CLI:
SHOW pi_demo.STABLES;
SHOW pi_demo.TABLES;
DESCRIBE pi_demo.volt_float32;
Then run time-bounded queries against the actual tables. For single-column mode, compare each source archived event. For multi-column mode, compare by element, attribute, and time separately; each change need not contain a complete latest snapshot of all attributes. Total row count cannot replace the valid record count for each attribute, and values must not be compared without their status codes.
Review fixed CSV files and automatic discovery rules separately. After trimming single-column POINT mappings, also disable automatic addition and verify the scope. Disabling automatic addition in AF multi-column mode does not restrict template initialization. For the relevant rules, see PI dataset filtering. For maintenance switches and deletion risks, see PI historical backfill and real-time continuation.