Skip to main content

Developer's Guide

When developing an application and planning to use TDengine as a tool for time-series data processing, here are several steps to follow:

  1. Determine the Connection Method to TDengine: Regardless of the programming language you use, you can always connect via the REST interface. However, you can also use the dedicated connectors available for each programming language for a more convenient connection.

  2. Define the Data Model Based on Your Application Scenario: Depending on the characteristics of your data, decide whether to create one or multiple databases; differentiate between static tags and collected data, establish the correct supertable, and create subtables.

  3. Decide on the Data Insertion Method: TDengine supports standard SQL for data writing, but it also supports Schemaless mode, allowing you to write data directly without manually creating tables.

  4. Determine the SQL Queries Needed: Based on business requirements, identify which SQL query statements you need to write.

  5. For Lightweight Real-time Statistical Analysis: If you plan to perform lightweight real-time statistical analysis on time-series data, including various monitoring dashboards, it is recommended to utilize TDengine 3.0’s stream computing capabilities without deploying complex stream processing systems like Spark or Flink.

  6. For Applications Needing Data Consumption Notifications: If your application has modules that need to consume inserted data and require notifications for new data inserts, it is recommended to use the data subscription feature provided by TDengine, rather than deploying Kafka or other message queue software.

  7. Utilize TDengine’s Cache Feature: In many scenarios (e.g., vehicle management), if your application needs to retrieve the latest status of each data collection point, it is advisable to use TDengine’s Cache feature instead of deploying separate caching software like Redis.

  8. Use User-Defined Functions (UDFs) if Necessary: If you find that TDengine's functions do not meet your requirements, you can create user-defined functions (UDFs) to solve your problems.

This section is organized according to the above sequence. For better understanding, TDengine provides example code for each feature and supported programming language, located in the Example Code. All example codes are verified for correctness through CI, with the scripts located at Example Code CI.

If you wish to delve deeper into SQL usage, refer to the SQL Manual. For more information on the use of each connector, please read the Connector Reference Guide. If you want to integrate TDengine with third-party systems, such as Grafana, please refer to Third-party Tools.

If you encounter any issues during development, please click on the "Feedback Issues" link at the bottom of each page to submit an issue directly on GitHub: Feedback Issues.

📄️ Connecting to TDengine

TDengine provides a rich set of application development interfaces. To facilitate users in quickly developing their applications, TDengine supports various programming language connectors, including official connectors for C/C++, Java, Python, Go, Node.js, C#, Rust, Lua (community-contributed), and PHP (community-contributed). These connectors support connecting to TDengine clusters using native interfaces (taosc) and REST interfaces (not supported by some languages). Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, Lua connector, and PHP connector. Additionally, TDengine can directly call the REST API provided by taosadapter for data writing and querying operations.

📄️ Running SQL Statements

TDengine provides comprehensive support for SQL, allowing users to perform data queries, inserts, and deletions using familiar SQL syntax. TDengine's SQL also supports database and table management operations, such as creating, modifying, and deleting databases and tables. TDengine extends standard SQL by introducing features specific to time-series data processing, such as aggregation queries, downsampling, and interpolation queries, to accommodate the characteristics of time-series data. These extensions enable users to handle time-series data more efficiently and conduct complex data analysis and processing. For specific supported SQL syntax, please refer to TDengine SQL.

📄️ Schemaless Ingestion

In Internet of Things (IoT) applications, it is often necessary to collect a large number of data points to achieve various functionalities such as automated management, business analysis, and device monitoring. However, due to reasons like version upgrades of application logic and adjustments in the hardware of devices, the data collection items may change frequently. To address this challenge, TDengine provides a schemaless writing mode aimed at simplifying the data recording process.

📄️ Manage Consumers

TDengine provides data subscription and consumption interfaces similar to those of message queue products. In many scenarios, using TDengine's time-series big data platform eliminates the need to integrate message queue products, thereby simplifying application design and reducing operational costs. This chapter introduces the relevant API for data subscription for various language connectors and how to use them. For basic knowledge of data subscription, please refer to Data Subscription.