Presto/Trino SQL API

ChaosSearch includes support for running SQL commands using the Presto/Trino SQL dialect.

As part of the SQL Analytics feature, ChaosSearch supports SQL SELECT commands using the Presto/Trino dialect. For more information about the commands and supported syntax, see SQL Syntax Support.

SQL queries can be run from the SQL Analytics area of the ChaosSearch console, and from tools that use a standard Trino JDBC driver. As one example, you could download and use the Trino CLI to connect to the ChaosSearch environment and run SQL queries.

The following example shows a sample session that uses the Trino CLI to connect to a ChaosSearch environment using a ChaosSearch API key for authentication, list some tables, and then run a small sample query:

export TRINO_PASSWORD='<API secret string>'

./trino https://mycompany.chaossearch.com --user=<API Client Key> --password
trino>

trino> show tables like '*cloudfront*';
           Table            
----------------------------
 abc-cloudfront-view        
 abc-cloudfront-xlarge-view 
 
trino>  SELECT cs_uri_stem, COUNT(*) AS access_count
    -> FROM "abc-cloudfront-xlarge-view"
    -> GROUP BY cs_uri_stem
    -> ORDER BY access_count DESC
    -> LIMIT 5;
          cs_uri_stem          | access_count 
-------------------------------+--------------
 /atom.xml                     |       3415.0 
 /                             |       1018.0 
 /robots.txt                   |        813.0 
 /favicon.png                  |        474.0 
 /javascripts/modernizr-2.0.js |        446.0 
(5 rows)
trino>