Developer's Guide
If you plan to use TDengine as a time-series data platform for application development, you typically need to complete the following:
- Choose a connection method. Regardless of the programming language, you can access TDengine through the REST API. Most languages also provide dedicated connectors for connecting, writing, and querying from your application.
- Design the data model. Based on the application scenario and data characteristics, decide whether to create one or more databases; distinguish static tags from collected metrics; create the correct supertables; then create child tables as needed.
- Choose a write method. TDengine supports standard SQL writes and parameter-binding writes. It also supports schemaless writes, so you can write data using line protocols directly and reduce the cost of creating tables by hand.
- Write query SQL. Based on business requirements, write the queries you need for statistics, filtering, and analysis.
- Perform real-time statistical analysis. If you need lightweight real-time statistics on time-series data (including monitoring dashboards), prefer TDengine stream processing instead of deploying complex streaming systems such as Spark or Flink.
- Consume newly written data. If modules in your application need to consume written data and be notified when new data arrives, prefer TDengine data subscription instead of deploying Kafka or other message queue software.
- Obtain the latest status. In many scenarios (such as vehicle management), applications need the latest status of each data collection point. Prefer TDengine Cache instead of deploying separate caching software such as Redis.
- Extend compute capabilities. If built-in functions do not meet your needs, use user-defined functions (UDF) to extend compute logic.
This chapter is organized along the development path above. For easier understanding, TDengine provides example code for each feature and supported programming language at Example Code. Example correctness is covered by CI; the scripts are at Example Code CI.
This chapter includes:
- Connecting to TDengine: Install drivers and connectors; establish WebSocket or native connections.
- Running SQL Statements: Create databases and tables; write and query data.
- Parameter Binding: High-performance writes with STMT / STMT2.
- Schemaless Ingestion: Write with InfluxDB / OpenTSDB and other line protocols.
- Ingesting Data Efficiently: Connector high-throughput features and performance tips.
- User-Defined Functions (UDF): C / Python user-defined functions.
- Managing Consumers: TMQ consumer APIs and language examples.
- Client Libraries: Language connectors and REST API details.
- Error Codes: Client and server error code reference.
For SQL syntax details, see TDengine SQL. To integrate TDengine with Grafana and other third-party systems, see Third-Party Tools.
If you encounter problems during development, use Report Issue at the bottom of each page to submit a GitHub Issue.