事前状態
- 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
ドキュメントはこちら
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"
}