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

InfluxDB is a time series database that can be used to collect data and monitor the system and devices, especially Edge devices.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

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

Implementation

The required arguments to establish a connection are as follows:

  • influxdb_url is the hosted URL of InfluxDB Cloud.
  • influxdb_token is the authentication token for the hosted InfluxDB Cloud instance.
  • influxdb_db_name is the database name of the InfluxDB Cloud instance.
  • influxdb_table_name is the table name of the InfluxDB Cloud instance.

Please follow this link to generate token for accessing InfluxDB API.

Usage

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

CREATE DATABASE influxdb_source
WITH
    ENGINE = 'influxdb',
    PARAMETERS = {
        "influxdb_url": "<influxdb-hosted-url>",
        "influxdb_token": "<api-key-token",
        "influxdb_db_name": "<database-name>",
        "influxdb_table_name": "<table-name>"
    };

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

SELECT name, time, sensor_id, temperature
FROM influxdb_source.tables
ORDER BY temperature DESC
LIMIT 65;