Using the SQL Console

June 16th, 2020

The Mango SQL Console provides the ability to directly access the system's database for both querying and updating. This facility is provided primarily for troubleshooting or system repair. It is not appropriate for regular use due to the risk of data corruption.

Only valid individual SQL statements may be submitted. Do not end your statements with ';' characters.

To get a list of tables created by your Mango Automation instance, click the Get table list button

Screen Shot 2018-12-03 at 7.28.27 PM.png

Useful SQL Commands

Total number of Data Points:

select count(*) from dataPoints

Total number of Events

select count(*) from events

Useful information

When looking at data in the events table you may want want to sort by the alarm level. You can reference this list to determine the numeric representation of the log levels:

  • NONE = 0
  • URGENT = 3
  • DO_NOT_LOG = -2

Quickly Purge Large Table

During database conversion you may need to purge the contents of a large MySQL table such as the pointValues table. These steps will allow you to do this quickly and efficiently.

  1. rename the pointValues table to pointValues_old

  2. se this SQL command:

CREATE TABLE pointValues SELECT * FROM pointValues_old LIMIT 0
  1. Drop the pointValues_old table.

Note: this will permanently delete all pointValues data

Copyright © 2024 Radix IoT, LLC.