Help us understand the problem. What is going on with this article?

TimestreamにAWS CLIでクエリ

事前状態

  • awscliを最新にする
  • Timestreamでサンプルデータベース作っておく

ヘルプ

$ aws timestream-query help
TIMESTREAM-QUERY()                                          TIMESTREAM-QUERY()



NAME
       timestream-query -

DESCRIPTION
AVAILABLE COMMANDS
       o cancel-query

       o describe-endpoints

       o help

       o query

ドキュメントはこちら

https://docs.aws.amazon.com/cli/latest/reference/timestream-query/query.html

CLIでクエリ

$ aws timestream-query query --query-string "SELECT * FROM testdb.IoT ORDER BY time DESC LIMIT 2"
{
    "Rows": [
        {
            "Data": [
                {
                    "ScalarValue": "Alpha"
                },
                {
                    "ScalarValue": "21135517"
                },
                {
                    "ScalarValue": "100"
                },
                {
                    "ScalarValue": "359"
                },
                {
                    "ScalarValue": "1000"
                },
                {
                    "ScalarValue": "Peterbilt"
                },
                {
                    "NullValue": true
                },
                {
                    "ScalarValue": "34.7465° N, 92.2896° W"
                },
                {
                    "ScalarValue": "location"
                },
                {
                    "ScalarValue": "2020-10-23 03:33:23.716000000"
                }
            ]
        },
        {
            "Data": [
                {
                    "ScalarValue": "Alpha"
                },
                {
                    "ScalarValue": "8598979964"
                },
                {
                    "ScalarValue": "150"
                },
                {
                    "ScalarValue": "C-600"
                },
                {
                    "ScalarValue": "1000"
                },
                {
                    "ScalarValue": "Ford"
                },
                {
                    "ScalarValue": "14.0"
                },
                {
                    "NullValue": true
                },
                {
                    "ScalarValue": "speed"
                },
                {
                    "ScalarValue": "2020-10-23 03:33:15.708000000"
                }
            ]
        }
    ],
    "ColumnInfo": [
        {
            "Name": "fleet",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "truck_id",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "fuel_capacity",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "model",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "load_capacity",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "make",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "measure_value::double",
            "Type": {
                "ScalarType": "DOUBLE"
            }
        },
        {
            "Name": "measure_value::varchar",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "measure_name",
            "Type": {
                "ScalarType": "VARCHAR"
            }
        },
        {
            "Name": "time",
            "Type": {
                "ScalarType": "TIMESTAMP"
            }
        }
    ],
    "QueryId": "AEBQEAMXYYX46KAC5AWWAQMNHBHRRDECDAFOKKQ45N4PIVWTA3D5BVXELIKF4HA"
}
pioho07
こちらに記載の内容は所属会社とは関係ありませぬ。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away