Querying Data

The Hydrolix query language is an ANSI-compliant SQL, based on Yandex ClickHouse query language. Queries are passed via the Hydrolix Query API which offers programmatic access to your data.

To query data,

  1. Ingest some data
  2. Create a view schema for the data
  3. Construct the WHERE clause
  4. Define the query conditions
  5. Execute the query against the Query API

Build a SQL Query

When querying Hydrolix, it is important to follow these steps:

  1. Specify the project name and the table name within the FROM portion of the SELECT statement separated by a period (.).
SELECT ……
  FROM project_name.table_name  
  WHERE ……
  1. Specify a view schema

    Hydrolix has the notion that a single data set can have different query data structures. The query data structure, or view schema allows for a user’s access to a data set to be restricted to a set of columns, but can also be used to set the data type for a column. For example, something that is stored as a number may also need to be operated on as a string sometimes.

    If no view is specified and a default view has been defined, the view schema is not required as part of the SQL.

  2. A where clause

    When referencing data in tables, a time specification within a WHERE predicate is required. This predicate should reference the primary datetime column that was specified in the transform schema when the data was ingested.

SELECT count(timestamp) AS count
  FROM my_first_project.the_table
  WHERE (timestamp BETWEEN1977-04-25 00:00:00AND2010-04-25 23:00:00)
  1. Define the rest of the query.

    Refer to the Hydrolix tutorials and SQL Referece to understand query syntax and see running examples.

  2. Execute the query

    Queries are sent to Hydrolix via the Query API. The only required parameter is “query” to pass in the query. Query results are returned as JSON.