pydruid: use a query as datasource

552 Views Asked by At

I am trying to write a query in pydruid, which uses another query as datasource. Druid itself supports is by setting datasource like this:

 "dataSource": {
    "type": "query",
    "query": {
      "queryType": "groupBy",
      "dataSource": "site_traffic",
      "intervals": ["0000/3000"],
      "granularity": "all",
      "dimensions": ["page"],
      "aggregations": [
        { "type": "count", "name": "hits" }
      ]
    }...
}

but I dont know how to implement it in pydruid. I tried doing this:

source = self.client.groupby( ... )
top_n = self.client.topn(
        datasource=source,...
)

but it give me an error, saying that datasource can only be a string or list of strings. How can I do this? Can it be done at all? if not, what are my options?

0

There are 0 best solutions below