Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON format output for http query interface #4764

Open
sunng87 opened this issue Sep 24, 2024 · 0 comments
Open

JSON format output for http query interface #4764

sunng87 opened this issue Sep 24, 2024 · 0 comments
Labels
C-enhancement Category Enhancements help wanted Extra attention is needed

Comments

@sunng87
Copy link
Member

sunng87 commented Sep 24, 2024

What type of enhancement is this?

API improvement

What does the enhancement do?

Some BI or visualization tools like PowerBI accepts json data from custom web apis. So if we offer json based http API, it's possible to integration these type of tool without any modification from both side.

Before, we need to modify the database driver of these type of tools, like this and this, in order to make it work with GreptimeDB. But for close-source tools or hosted ones, there is no way to do that.

Our default json output is in a table based data mode, which is not very friendly for client to consume directly.

{
  "output": [
    {
      "records": {
        "schema": {
          "column_schemas": [
            {
              "name": "host",
              "data_type": "String"
            },
            {
              "name": "ts",
              "data_type": "TimestampMillisecond"
            },
            {
              "name": "cpu",
              "data_type": "Float64"
            },
            {
              "name": "memory",
              "data_type": "Float64"
            }
          ]
        },
        "rows": [
          [
            "127.0.0.1",
            1667446797450,
            0.1,
            0.4
          ],
          [
            "127.0.0.1",
            1667446798450,
            0.5,
            0.2
          ],
          [
            "127.0.0.2",
            1667446798450,
            0.2,
            0.3
          ]
        ],
        "total_rows": 3
      }
    }
  ],
  "execution_time_ms": 23
}

The idea it to create an alternative format, say format=json, and the data format should look like:

{
  "data": [
    {
      "host": "127.0.0.1",
      "ts": 1667446797450,
      "cpu": 0.2,
      "memory": 0.3
    },
    ...
  ],
  "execution_time_ms": 23
}

Implementation challenges

No response

@sunng87 sunng87 added C-enhancement Category Enhancements help wanted Extra attention is needed labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant