Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Code Block
{
         "parameters" : {
            "time_period" : "time_difference",
            "end_date" : "7-Mar-2014 14:03:01",
            "start_date" : "7-Mar-2014 13:48:01"
         },
         "datasets" : [
            {
               "parameters" : {
                  "aggregation_function" : 1,
                  "lineType" : "column",
                  "query" : "select * from nodes",
                  "value_column" : "sum",
                  "axis" : "0",
                  "groupby" : [
                     "group_column"
                  ]
               },
               "data_source" : "local_mysql",
               "options" : {
                  "datasetTitle" : "Groups"
               },
               "name" : "sqlquery_dataset",
               "typemodel" : "sql_query"
            }
         ],
         "options" : {
            "titleText" : ""
         },
         "name" : "SQL Test",
         "typemodel_view" : "non-time-chart"
      },

Dataset:

...

Example: SELECT * FROM interface WHERE UNIX_TIMESTAMP(lastUpdate) >= time.start AND UNIX_TIMESTAMP(lastUpdate) < time.end AND customerName = user.customer

groupby:

If the data returned from the SQL statement needs to be grouped (for summing or counting, works much like SQL GROUP BY) use this field to specify the group, as an array, order matters.  This works in tandem with the aggregation function to produce results.  Just like in an SQL GROUP BY each column requires a function to aggregate it's result.

...