爲了便於使用,Druid 包中還提供了一個 SQL 命令行客戶端工具,這個工具位於 bin/dsql
目錄中。
如果你直接運行 bin/dsql
的話,你將會看到下面的提示輸出:
Welcome to dsql, the command-line client for Druid SQL.
Type "\h" for help.
dsql>
如果希望進行查詢的話,將你的 SQL 張貼到 dsql
提示光標後面,然後單擊回車:
dsql> SELECT page, COUNT(*) AS Edits FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' GROUP BY page ORDER BY Edits DESC LIMIT 10;
┌──────────────────────────────────────────────────────────┬───────┐
│ page │ Edits │
├──────────────────────────────────────────────────────────┼───────┤
│ Wikipedia:Vandalismusmeldung │ 33 │
│ User:Cyde/List of candidates for speedy deletion/Subpage │ 28 │
│ Jeremy Corbyn │ 27 │
│ Wikipedia:Administrators' noticeboard/Incidents │ 21 │
│ Flavia Pennetta │ 20 │
│ Total Drama Presents: The Ridonculous Race │ 18 │
│ User talk:Dudeperson176123 │ 18 │
│ Wikipédia:Le Bistro/12 septembre 2015 │ 18 │
│ Wikipedia:In the news/Candidates │ 17 │
│ Wikipedia:Requests for page protection │ 17 │
└──────────────────────────────────────────────────────────┴───────┘
Retrieved 10 rows in 0.06s.
如下圖,就是我們使用 dsql 工具連接上我們一個服務器後進行查詢的返回界面
上面的數據爲服務器上真實的數據。