Grafana dashboard: My Data Dictionary Viewer
Description: MyDDV (MySQL Data Dictionary Viewer) displays most important informations on table/column definition. It also shows a cool graph with relationship between tables using the Node Graph plugin (Beta)

The dashboard shows columns attributes, pie charts with most used data types and a graph with relationships between tables (referential constraints). You can choose databases, tables and columns to be shown using variables.
This dashboard does not require any data collection since it uses the standard data dictionary tables in the INFORMATION_SCHEMA.

{
  "__inputs": [
    {
      "name": "DS_MYMYSQL",
      "label": "MyMySQL",
      "description": "MySQL or MariaDB data source",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.0-pre"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "nodeGraph",
      "name": "Node Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1643701104446,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Time"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Time"
              },
              {
                "id": "unit",
                "value": "time: YYYY-MM-DD HH:mm:ss"
              },
              {
                "id": "custom.align"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "column_position"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.align"
              },
              {
                "id": "custom.width",
                "value": 106
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "is_nullable"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "null"
              },
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "custom.align"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "rgba(245, 54, 54, 0.9)",
                      "value": null
                    },
                    {
                      "color": "#5794F2",
                      "value": 0
                    },
                    {
                      "color": "rgba(50, 172, 45, 0.97)",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "is_pk"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "custom.align"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "rgba(245, 54, 54, 0.9)",
                      "value": null
                    },
                    {
                      "color": "rgba(33, 33, 33, 0.5)",
                      "value": 0
                    },
                    {
                      "color": "#5794F2",
                      "value": 1
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 77
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "is_uk"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "custom.align"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "rgba(245, 54, 54, 0.9)",
                      "value": null
                    },
                    {
                      "color": "rgba(33, 33, 33, 0.49)",
                      "value": 0
                    },
                    {
                      "color": "#5794F2",
                      "value": 1
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 72
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "null"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 68
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "column_comment"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 185
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "table_name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 167
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "table_schema"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 162
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "column_default"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 219
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "is_sort"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 81
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "column_name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 234
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "column_type"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 264
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ordinal_position"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 382
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.4.0-pre",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select  table_schema, table_name,\ncolumn_name, column_type, column_default, column_comment,\nordinal_position, is_nullable \n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n order by table_schema, table_name, ordinal_position\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Data Definition",
      "transformations": [
        {
          "id": "merge",
          "options": {
            "reducers": []
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 4,
        "x": 0,
        "y": 13
      },
      "id": 5,
      "links": [],
      "maxDataPoints": 3,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "bottom",
          "values": [
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, SUBSTRING_INDEX(column_type,'(',1) as metric, count(*) as value\n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n group by SUBSTRING_INDEX(column_type,'(',1) -- substr(column_type ,1,4)\n order by 3 desc\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Data Types",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 4,
        "x": 4,
        "y": 13
      },
      "id": 4,
      "links": [],
      "maxDataPoints": 3,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "bottom",
          "values": [
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, substr(column_type, 1,20) as metric, count(*) as value\n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n group by substr(column_type, 1,20)\n order by 3 desc\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Data Types (details)",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 13
      },
      "id": 6,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.4.0-pre",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, count(distinct table_schema)\n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Schemata",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 13
      },
      "id": 10,
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select concat(CONSTRAINT_SCHEMA,'.',TABLE_NAME) id, table_name title, CONSTRAINT_SCHEMA subTitle\n  from information_schema.referential_constraints\nUNION\nselect concat(UNIQUE_CONSTRAINT_SCHEMA,'.',REFERENCED_TABLE_NAME) id, REFERENCED_TABLE_NAME, UNIQUE_CONSTRAINT_SCHEMA\n  from information_schema.referential_constraints",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select concat(CONSTRAINT_SCHEMA,'.',TABLE_NAME, '-', UNIQUE_CONSTRAINT_SCHEMA,'.',REFERENCED_TABLE_NAME) id,\n       concat(CONSTRAINT_SCHEMA,'.',TABLE_NAME) target,\n       concat(UNIQUE_CONSTRAINT_SCHEMA,'.',REFERENCED_TABLE_NAME) source, 'Foreing Key' mainStat\n  from information_schema.referential_constraints",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Relations",
      "type": "nodeGraph"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 16
      },
      "id": 7,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.4.0-pre",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, count(distinct table_schema, table_name)\n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Tables",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYMYSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 19
      },
      "id": 8,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.4.0-pre",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYMYSQL}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, count(*)\n  from information_schema.columns\n where table_schema in($database)\n   and table_name like '$tab'\n   and column_name like '$col'\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "v1"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "mylog",
          "timeColumn": "c1",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Columns",
      "type": "stat"
    }
  ],
  "schemaVersion": 34,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "MyMySQL",
          "value": "MyMySQL"
        },
        "hide": 1,
        "includeAll": false,
        "multi": false,
        "name": "MyInstance",
        "options": [],
        "query": "mysql",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "mysql",
          "uid": "${DS_MYMYSQL}"
        },
        "definition": "select schema_name from INFORMATION_SCHEMA.schemata",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "database",
        "options": [],
        "query": "select schema_name from INFORMATION_SCHEMA.schemata",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": true,
          "text": "%",
          "value": "%"
        },
        "hide": 0,
        "label": "Table (LIKE)",
        "name": "tab",
        "options": [
          {
            "selected": true,
            "text": "%",
            "value": "%"
          }
        ],
        "query": "%",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": true,
          "text": "%",
          "value": "%"
        },
        "hide": 0,
        "label": "Column (LIKE)",
        "name": "col",
        "options": [
          {
            "selected": true,
            "text": "%",
            "value": "%"
          }
        ],
        "query": "%",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "My Data Dictionary Viewer",
  "uid": "NzY1kux7k",
  "version": 7,
  "weekStart": "",
  "gnetId": 15657,
  "description": "MyDDV (MySQL Data Dictionary Viewer) displays most important informations on table/column definition. It also shows a cool graph with relationship between tables using the Node Graph plugin (Beta)"
}