This is the implementation of the TDEngine data handler for MindsDB.

TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. It enables efficient, real-time data ingestion, processing, and monitoring of TB and even PB scale data per day, generated by billions of sensors and data collectors. TDengine differentiates itself from other time-series databases with numerous advantages, such as high performance, simplified solution, cloud-native, ease of use, easy data analytics, and open-source.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or use MindsDB Cloud.
  2. To connect TDengine to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to TDengine.

Implementation

This handler is implemented using taos/taosrest, a Python library that allows you to use Python code to run SQL commands on the TDEngine server.

The required arguments to establish a connection are as follows:

  • user is the username associated with the server.
  • password is the password to authenticate your access.
  • url is the URL to the TDEngine server. For local server, the URL is localhost:6041 by default.
  • token is the unique token provided while using TDEngine Cloud.
  • database is the database name to be connected.

Usage

In order to make use of this handler and connect to the TDEngine database in MindsDB, the following syntax can be used:

CREATE DATABASE tdengine_datasource
WITH
    ENGINE = 'tdengine',
    PARAMETERS = {
    "user": "tdengine_user",
    "password": "password",
    "url": "localhost:6041",
    "token": "token",
    "database": "tdengine_db"
    };

You can specify token instead of user and password while using TDEngine.

You can use this established connection to query your table as follows:

SELECT *
FROM tdengine_datasource.demo_table;