Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Last active September 19, 2025 14:52
Show Gist options
  • Save kylebrandt/16b044a84601316eece70f1d6e9ccc95 to your computer and use it in GitHub Desktop.
Save kylebrandt/16b044a84601316eece70f1d6e9ccc95 to your computer and use it in GitHub Desktop.

Revisions

  1. kylebrandt revised this gist Sep 19, 2025. 2 changed files with 15 additions and 33 deletions.
    46 changes: 14 additions & 32 deletions response.json → 0response.json
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,14 @@
    HTTP/1.1 200 OK
    Audit-Id: 5b82aaf1-4ba7-48bc-bb7b-94a7b89c6c5e
    Cache-Control: no-store
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    X-Frame-Options: deny
    X-Xss-Protection: 1; mode=block
    Date: Fri, 19 Sep 2025 14:51:41 GMT
    Content-Length: 902
    Connection: close

    {
    "kind": "SQLSchemas",
    "apiVersion": "query.grafana.app/v0alpha1",
    @@ -42,38 +53,9 @@
    ]
    },
    "dog": {
    "columns": [
    {
    "name": "__metric_name__",
    "mysqlType": "text",
    "nullable": false,
    "dataFrameFieldType": "string"
    },
    {
    "name": "__value__",
    "mysqlType": "double",
    "nullable": true,
    "dataFrameFieldType": "*float64"
    },
    {
    "name": "host",
    "mysqlType": "text",
    "nullable": true,
    "dataFrameFieldType": "*string"
    }
    ],
    "sampleRows": [
    [
    "cpu",
    3.14,
    "a"
    ],
    [
    "cpu",
    93.14,
    "e"
    ]
    ]
    "columns": null,
    "sampleRows": null,
    "error": "[sse.dataQueryError] failed to execute query [dog]: invalid query type. aframes_builder"
    },
    "fox": {
    "columns": [
    2 changes: 1 addition & 1 deletion request.http
    Original file line number Diff line number Diff line change
    @@ -181,7 +181,7 @@ content-type: application/json
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "frames_builder",
    "queryType": "aframes_builder",
    "rawFrameSource": "staticScenario",
    "refId": "dog",
    "resultState": "success",
  2. kylebrandt revised this gist Sep 19, 2025. 2 changed files with 36 additions and 18 deletions.
    4 changes: 2 additions & 2 deletions request.http
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ### Req
    POST http://admin:admin@localhost:3000/apis/query.grafana.app/v0alpha1/namespaces/default/sqlschema?ds_type=__expr__&expression=true
    POST http://admin:admin@localhost:3000/apis/query.grafana.app/v0alpha1/namespaces/default/sqlschemas?ds_type=__expr__&expression=true
    content-type: application/json

    {
    @@ -133,7 +133,7 @@ content-type: application/json
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "aframes_builder",
    "queryType": "frames_builder",
    "rawFrameSource": "staticScenario",
    "refId": "fox",
    "resultState": "success",
    50 changes: 34 additions & 16 deletions response.json
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,7 @@
    HTTP/1.1 200 OK
    Audit-Id: 5cd78be6-d3df-4510-88b2-11b0c2035e4b
    Cache-Control: no-store
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    X-Frame-Options: deny
    X-Xss-Protection: 1; mode=block
    Date: Thu, 18 Sep 2025 15:19:14 GMT
    Content-Length: 908
    Connection: close

    {
    "kind": "SQLSchemaResponse",
    "kind": "SQLSchemas",
    "apiVersion": "query.grafana.app/v0alpha1",
    "SQLSchema": {
    "sqlSchemas": {
    "cat": {
    "columns": [
    {
    @@ -87,9 +76,38 @@ Connection: close
    ]
    },
    "fox": {
    "columns": null,
    "sampleRows": null,
    "error": "[sse.dataQueryError] failed to execute query [fox]: invalid query type. aframes_builder"
    "columns": [
    {
    "name": "__metric_name__",
    "mysqlType": "text",
    "nullable": false,
    "dataFrameFieldType": "string"
    },
    {
    "name": "__value__",
    "mysqlType": "double",
    "nullable": true,
    "dataFrameFieldType": "*float64"
    },
    {
    "name": "host",
    "mysqlType": "text",
    "nullable": true,
    "dataFrameFieldType": "*string"
    }
    ],
    "sampleRows": [
    [
    "cpu",
    3.14,
    "a"
    ],
    [
    "cpu",
    93.14,
    "c"
    ]
    ]
    }
    }
    }
  3. kylebrandt revised this gist Sep 18, 2025. 1 changed file with 11 additions and 5 deletions.
    16 changes: 11 additions & 5 deletions response.json
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,14 @@
    HTTP/1.1 200 OK
    Audit-Id: 5cd78be6-d3df-4510-88b2-11b0c2035e4b
    Cache-Control: no-store
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    X-Frame-Options: deny
    X-Xss-Protection: 1; mode=block
    Date: Thu, 18 Sep 2025 15:19:14 GMT
    Content-Length: 908
    Connection: close

    {
    "kind": "SQLSchemaResponse",
    "apiVersion": "query.grafana.app/v0alpha1",
    @@ -24,9 +35,6 @@
    }
    ],
    "sampleRows": [
    null,
    null,
    null,
    [
    "cpu",
    3.14,
    @@ -66,8 +74,6 @@
    }
    ],
    "sampleRows": [
    null,
    null,
    [
    "cpu",
    3.14,
  4. kylebrandt revised this gist Sep 18, 2025. 1 changed file with 6 additions and 26 deletions.
    32 changes: 6 additions & 26 deletions response.json
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,9 @@
    }
    ],
    "sampleRows": [
    null,
    null,
    null,
    [
    "cpu",
    3.14,
    @@ -38,31 +41,6 @@
    "cpu",
    3,
    "x"
    ],
    [
    "cpu",
    2,
    "y"
    ],
    [
    "cpu",
    4,
    "z"
    ],
    [
    "cpu",
    1,
    "u"
    ],
    [
    "cpu",
    2,
    "v"
    ],
    [
    "cpu",
    3,
    "w"
    ]
    ]
    },
    @@ -88,6 +66,8 @@
    }
    ],
    "sampleRows": [
    null,
    null,
    [
    "cpu",
    3.14,
    @@ -106,4 +86,4 @@
    "error": "[sse.dataQueryError] failed to execute query [fox]: invalid query type. aframes_builder"
    }
    }
    }
    }
  5. kylebrandt revised this gist Sep 18, 2025. 2 changed files with 106 additions and 74 deletions.
    2 changes: 1 addition & 1 deletion request.http
    Original file line number Diff line number Diff line change
    @@ -133,7 +133,7 @@ content-type: application/json
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "frames_builder",
    "queryType": "aframes_builder",
    "rawFrameSource": "staticScenario",
    "refId": "fox",
    "resultState": "success",
    178 changes: 105 additions & 73 deletions response.json
    Original file line number Diff line number Diff line change
    @@ -1,77 +1,109 @@
    HTTP/1.1 200 OK
    Audit-Id: 2a1afb05-0d45-4485-9907-67fa854a51e7
    Cache-Control: no-store
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    X-Frame-Options: deny
    X-Xss-Protection: 1; mode=block
    Date: Tue, 16 Sep 2025 15:09:44 GMT
    Content-Length: 912
    Connection: close

    {
    "kind": "SQLSchemaResponse",
    "apiVersion": "query.grafana.app/v0alpha1",
    "SQLSchemaResponse": {
    "cat": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ],
    "dog": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ],
    "fox": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ]
    "SQLSchema": {
    "cat": {
    "columns": [
    {
    "name": "__metric_name__",
    "mysqlType": "text",
    "nullable": false,
    "dataFrameFieldType": "string"
    },
    {
    "name": "__value__",
    "mysqlType": "double",
    "nullable": true,
    "dataFrameFieldType": "*float64"
    },
    {
    "name": "host",
    "mysqlType": "text",
    "nullable": true,
    "dataFrameFieldType": "*string"
    }
    ],
    "sampleRows": [
    [
    "cpu",
    3.14,
    "a"
    ],
    [
    "cpu",
    93.14,
    "b"
    ],
    [
    "cpu",
    3,
    "x"
    ],
    [
    "cpu",
    2,
    "y"
    ],
    [
    "cpu",
    4,
    "z"
    ],
    [
    "cpu",
    1,
    "u"
    ],
    [
    "cpu",
    2,
    "v"
    ],
    [
    "cpu",
    3,
    "w"
    ]
    ]
    },
    "dog": {
    "columns": [
    {
    "name": "__metric_name__",
    "mysqlType": "text",
    "nullable": false,
    "dataFrameFieldType": "string"
    },
    {
    "name": "__value__",
    "mysqlType": "double",
    "nullable": true,
    "dataFrameFieldType": "*float64"
    },
    {
    "name": "host",
    "mysqlType": "text",
    "nullable": true,
    "dataFrameFieldType": "*string"
    }
    ],
    "sampleRows": [
    [
    "cpu",
    3.14,
    "a"
    ],
    [
    "cpu",
    93.14,
    "e"
    ]
    ]
    },
    "fox": {
    "columns": null,
    "sampleRows": null,
    "error": "[sse.dataQueryError] failed to execute query [fox]: invalid query type. aframes_builder"
    }
    }
    }
    }
  6. kylebrandt created this gist Sep 16, 2025.
    208 changes: 208 additions & 0 deletions request.http
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,208 @@
    ### Req
    POST http://admin:admin@localhost:3000/apis/query.grafana.app/v0alpha1/namespaces/default/sqlschema?ds_type=__expr__&expression=true
    content-type: application/json

    {
    "queries": [
    {
    "datasource": {
    "uid": "9c3MNrV4k",
    "type": "grafana-mock-datasource"
    },
    "frames": [
    {
    "count": 1,
    "disabled": false,
    "fields": [
    {
    "disabled": false,
    "labels": "host=a",
    "name": "cpu",
    "type": "nullable-float64",
    "value": "3.14"
    },
    {
    "disabled": false,
    "labels": "host=b",
    "name": "cpu",
    "type": "nullable-float64",
    "value": "93.14"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "3",
    "labels": "host=x"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "2",
    "labels": "host=y"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "4",
    "labels": "host=z"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "1",
    "labels": "host=u"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "2",
    "labels": "host=v"
    },
    {
    "name": "cpu",
    "type": "float64",
    "disabled": false,
    "value": "3",
    "labels": "host=w"
    }
    ],
    "frameInputType": "numeric-wide",
    "meta": {
    "type": "numeric-wide",
    "typeVersion": [
    0,
    1
    ]
    },
    "name": "New Frame",
    "source": "count"
    }
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "frames_builder",
    "rawFrameSource": "staticScenario",
    "refId": "cat",
    "resultState": "success",
    "scenario": "no-data",
    "datasourceId": 49,
    "intervalMs": 20000,
    "maxDataPoints": 1003
    },
    {
    "datasource": {
    "uid": "9c3MNrV4k",
    "type": "grafana-mock-datasource"
    },
    "frames": [
    {
    "count": 1,
    "disabled": false,
    "fields": [
    {
    "disabled": false,
    "labels": "host=a",
    "name": "cpu",
    "type": "nullable-float64",
    "value": "3.14"
    },
    {
    "disabled": false,
    "labels": "host=c",
    "name": "cpu",
    "type": "float64",
    "value": "93.14"
    }
    ],
    "frameInputType": "numeric-wide",
    "meta": {
    "type": "numeric-wide",
    "typeVersion": [
    0,
    1
    ]
    },
    "name": "New Frame",
    "source": "count"
    }
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "frames_builder",
    "rawFrameSource": "staticScenario",
    "refId": "fox",
    "resultState": "success",
    "scenario": "no-data",
    "datasourceId": 49,
    "intervalMs": 20000,
    "maxDataPoints": 1003
    },
    {
    "datasource": {
    "uid": "9c3MNrV4k",
    "type": "grafana-mock-datasource"
    },
    "frames": [
    {
    "count": 1,
    "disabled": false,
    "fields": [
    {
    "disabled": false,
    "labels": "host=a",
    "name": "cpu",
    "type": "nullable-float64",
    "value": "3.14"
    },
    {
    "disabled": false,
    "labels": "host=e",
    "name": "cpu",
    "type": "nullable-float64",
    "value": "93.14"
    }
    ],
    "frameInputType": "numeric-wide",
    "meta": {
    "type": "numeric-wide",
    "typeVersion": [
    0,
    1
    ]
    },
    "name": "New Frame",
    "source": "count"
    }
    ],
    "generatorSource": "frontend",
    "hide": true,
    "queryType": "frames_builder",
    "rawFrameSource": "staticScenario",
    "refId": "dog",
    "resultState": "success",
    "scenario": "no-data",
    "datasourceId": 49,
    "intervalMs": 20000,
    "maxDataPoints": 1003
    },
    {
    "datasource": {
    "type": "__expr__",
    "uid": "__expr__",
    "name": "Expression"
    },
    "expression": "$cat + $fox + $dog",
    "hide": false,
    "refId": "C",
    "type": "math",
    "window": ""
    }
    ],
    "from": "1690967121711",
    "to": "1690988721711"
    }
    77 changes: 77 additions & 0 deletions response.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,77 @@
    HTTP/1.1 200 OK
    Audit-Id: 2a1afb05-0d45-4485-9907-67fa854a51e7
    Cache-Control: no-store
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    X-Frame-Options: deny
    X-Xss-Protection: 1; mode=block
    Date: Tue, 16 Sep 2025 15:09:44 GMT
    Content-Length: 912
    Connection: close

    {
    "kind": "SQLSchemaResponse",
    "apiVersion": "query.grafana.app/v0alpha1",
    "SQLSchemaResponse": {
    "cat": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ],
    "dog": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ],
    "fox": [
    {
    "Name": "__metric_name__",
    "MySQLType": "text",
    "Nullable": false,
    "DataFrameFieldType": "string"
    },
    {
    "Name": "__value__",
    "MySQLType": "double",
    "Nullable": true,
    "DataFrameFieldType": "*float64"
    },
    {
    "Name": "host",
    "MySQLType": "text",
    "Nullable": true,
    "DataFrameFieldType": "*string"
    }
    ]
    }
    }