A MySQL Integration allows you to send data to a MySQL database.

Integration Configuration

ParameterDescription
nameThe Integration's display name. 
typeThe string MySQL.
descriptionA textual description of this Integration.
selector

See section Labels and Selectors.

params.host

MySQL host (required)

params.portMySQL port. (optional, default: 3306)
params.usernameMySQL user (required)
The user requires the following grants on the database below:
ALTER, CREATE, DELETE, INDEX, INSERT, SELECT, UPDATE
params.passwordMySQL password (required)
params.databaseMySQL database (required)
params.table_prefixThis prefix will be used in table names required to store data. (optional, only alphabetical characters are allowed)

Example

{
  "type": "MySQL",
  "name": "MySQL Integration",
  "params": {
    "host "mysql.example.com",
	"port": "3306",
	"username": "thingshub",
	"password": "secret-password",
	"database": "thingshub",
	"table_prefix": "th"
  },
  "selector": {
    "$or": [
      "all"
    ]
  }
}
JS

Data format

Device Mapping

This table will hold information of the device sending uplinks to this integration. The table name is device_mapping, but in case the table_prefix config is used then the table name is prefixed with table_prefix. eg: th_device_mapping.

FieldDescription
id

Database auto incremented id (integer)

device_idThings hub device id (string)
driverDriver of the device (string)
data_tableName of the table where the data from device is stored at the time of this uplink.
updated_atWhen this row has been last updated (datetime)
created_atWhen this row has been inserted. (datetime)

Device Data

The table that will hold the current data of the devices mapped in device_mapping table. This table name is determined base on the driver a device has at the time of uplink. Based on that driver the device_mapping.data_table field contains the name of this table with the table_prefix in case this exists. Eg.

  • smartmakers_nke_ino_1_1_0 - this is a table name where the prefix is not set and the device uses the smartmakers/nke-ino:1.1.0 driver
  • th_smartmakers_nke_s0_2_0 - this is a table name where table prefix is used and the driver is smartmakers/nke-s0:2.0
FieldDescription
id

Database auto incremented id (integer)

device_mapping_idRelational id of the device_mapping table. (integer)
Variable columnsThe rest of the table will contain columns based on the data returned from the device driver.