Skip to content

Sql4DDriver

srikalyan chandrashekar edited this page Jul 29, 2014 · 2 revisions

Description

A simple java (jdbc kind of) driver for Druid that understands DSQL (Druid SQL) .

Features

  1. Ability to fire groupBy, search, timeseries, topN, select queries.
  2. Accepts NamedParameters for template based queries(similar to Template JDBC mechanism in Spring). Ex:
 String searchContainsAndStrlenSort = "SELECT a, b FROM wiki WHERE interval BETWEEN :startT AND :endT WHICH CONTAINS(:someStuff) SORT('strlen')";
 NamedParameters params = new NamedParameters();
 params.add("someStuff", "somestuff");
 params.add("startT", new Date());
 params.add("endT", new DateTime());
 DDataSource  source = new DDataSource("abc.com", 23);
 source.setNamedParams(params);
 Either<JSONObject, JSONArray> response = source.query(searchContainsAndStrlenSort);
Clone this wiki locally