Fix: Expand multi-value template variables in prefixPath into multiple paths (#109)
* Expand multi-value template variables in prefixPath into multiple paths
Fix two issues with variable expansion in Grafana 11.4 (Scenes architecture):
1. Replace templateSrv.containsTemplate() with regex-based detection.
In Grafana 11.4's Scenes mode, containsTemplate() returns false for
${var} syntax even when the variable exists. Using a regex pattern
ensures reliable detection regardless of Grafana version.
2. Process prefixPath expansion for queries without sqlType field.
Previously only queries with sqlType === 'SQL: Full Customized' were
processed. Queries provisioned via JSON (without explicit sqlType)
were silently skipped.
The expansion logic now:
- Detects variables via regex pattern /\$\{(\w+)(?::[^}]*)?\}|\\b/
- Resolves values from scopedVars first, then falls back to getVariables()
- Handles $__all by expanding to all non-$__all options
- Supports both single-value and multi-value (array) variables
- Fully backward-compatible: literal paths pass through unchanged
Closes #108
* Address review: handle $__all in scopedVars and safer fallback
- When scopedVars provides $__all, expand using options list instead of
treating it as a literal path segment
- When variable cannot be resolved, fallback to replace() on the whole
path (preserving prior behavior) instead of only replacing the token
- Add tests for both cases
---------
Co-authored-by: xiangdong huang <hxd@timecho.com>Apache IoTDB Extras is a companion repository to the main Apache IoTDB project. It contains examples, integration modules, connectors, and additional tools that extend the functionality of IoTDB.
IoTDB (Internet of Things Database) is a time series database designed specifically for the Internet of Things (IoT) scenarios, with high performance for data ingestion, storage, and querying for time series data.
This repository provides integrations with popular data processing frameworks, visualization tools, and other systems to enhance IoTDB's ecosystem.
This repository includes:
Connectors: Integration modules for various data processing frameworks and systems
IoTDB Collector: Data collection framework for IoTDB
IoTDB Spring Boot Starter: Spring Boot integration for IoTDB
Kubernetes Support
MyBatis Generator: Code generation tools for database access
Examples: Sample applications and code examples demonstrating the use of IoTDB with various technologies
To build the project from source, follow these steps:
Clone the repository:
git clone https://github.com/apache/iotdb-extras.git cd iotdb-extras
Build the project with Maven:
# Build the entire project (includes distributions,iotdb-collector,mybatis-generator) mvn clean package -DskipTests # Or build all mvn clean package -DskipTests -Pwith-all-connectors,with-examples,with-springboot,with-grafana
The build artifacts will be located in the target directory of each module.
IoTDB-Extras uses Maven profiles to configure different build options. You can combine various profiles to build specific components:
with-springboot: Build Spring Boot integration
mvn clean package -Pwith-springboot -DskipTests
with-examples: Build example applications(Recommended for use in conjunction with Connector Profiles)
mvn clean package -Pwith-examples -DskipTests
with-all-connectors: Build all available connectors (includes Flink, Hadoop, Hive, Spark, Zeppelin. excludes Grafana)
mvn clean package -Pwith-all-connectors -DskipTests
with-spark: Build Spark connectors (includes spark-iotdb-connector, spark-iotdb-table-connector)
mvn clean package -Pwith-spark -DskipTests
with-flink: Build Flink connectors (includes flink-iotdb-connector, flink-sql-iotdb-connector, flink-tsfile-connector)
mvn clean package -Pwith-flink -DskipTests
with-grafana: Build Grafana connectors and plugins
mvn clean package -Pwith-grafana -DskipTests # (Recommend) If you want to build the Grafana plugin, use: mvn clean package -Pwith-grafana-plugin -DskipTests # To build the Grafana connector, use: mvn clean package -Pwith-grafana-connector -DskipTests
with-hadoop: Build Hadoop connector
mvn clean package -Pwith-hadoop -DskipTests
with-hive: Build Hive connector
mvn clean package -Pwith-hive -DskipTests
with-spark-tsfile: Build Spark TsFile connector (includes spark-tsfile, hadoop)
mvn clean package -Pwith-spark-tsfile -DskipTests
with-zeppelin: Build Zeppelin interpreter
mvn clean package -Pwith-zeppelin -DskipTests
When building the examples module, you can use these profiles:
with-springboot: Build Spring Boot examples
mvn clean package -Pwith-examples,with-springboot -DskipTests
with-flink: Build Flink examples
mvn clean package -Pwith-examples,with-flink -DskipTests
with-hadoop: Build Hadoop examples
mvn clean package -Pwith-examples,with-hadoop -DskipTests
with-spark: Build Spark examples
mvn clean package -Pwith-examples,with-spark -DskipTests
You can combine multiple profiles to build specific components:
# Build Flink and Spark connectors with examples mvn clean package -Pwith-flink,with-spark,with-examples -DskipTests # Build a complete distribution with all components mvn clean package -Pwith-all-connectors,with-examples,with-springboot -DskipTests
This repository includes a variety of examples demonstrating how to use IoTDB with different technologies:
org.apache.iotdb.flink.FlinkIoTDBSink.java to run the Flink job on local mini clusterorg.apache.iotdb.flink.FlinkTsFileBatchSource.java to create a TsFile and read it via a Flink DataSet joborg.apache.iotdb.flink.FlinkTsFileStreamSource.java to create a TsFile and read it via a Flink DataStream joborg.apache.iotdb.flink.FlinkTsFileBatchSink.java to write a TsFile via a Flink DataSet joborg.apache.iotdb.flink.FlinkTsFileStreamSink.java to write a TsFile via a Flink DataStream jobBatchSinkExample.java: Demonstrates batch writing to IoTDBBoundedScanExample.java: Shows bounded data scanningCDCExample.java: Illustrates Change Data CaptureLookupExample.java: Shows lookup functionalityStreamingSinkExample.java: Demonstrates streaming data writing<dependency> <groupId>org.apache.iotdb</groupId> <artifactId>spark-iotdb-table-connector-3.5</artifactId> </dependency>
| Key | Default | Description | Required |
|---|---|---|---|
| iotdb.database | -- | Database name in IoTDB | true |
| iotdb.table | -- | Table name in IoTDB | true |
| iotdb.username | root | Username to access IoTDB | false |
| iotdb.password | root | Password to access IoTDB | false |
| iotdb.urls | 127.0.0.1:6667 | Connection URLs | false |
For detailed usage instructions, please refer to the README files in the specific example directories:
You can also refer to module-specific documentation:
IoTDB components can be run using Docker. For more information, see the Docker documentation.
Apache IoTDB Extras is released under the Apache 2.0 License.
apache_iotdb, and then we'll invite you to the group.see Join the community for more!