diff --git a/pydruid/query.py b/pydruid/query.py index bfb9dd24..8ffd1fee 100644 --- a/pydruid/query.py +++ b/pydruid/query.py @@ -179,6 +179,10 @@ def export_pandas(self): nres = [] for item in self.result: nres += [e.get('event') for e in item['result'].get('events')] + elif self.query_type == "scan": + nres = [] + for item in self.result: + nres += [e for e in item.get('events')] else: raise NotImplementedError( 'Pandas export not implemented for query ' @@ -423,3 +427,20 @@ def search(self, args): ] self.validate_query(query_type, valid_parts, args) return self.build_query(query_type, args) + + def scan(self, args): + """ + A scan query returns raw Druid rows + + :param dict args: dict of args + + :return: select query + :rtype: Query + """ + query_type = 'scan' + valid_parts = [ + 'datasource', 'granularity', 'filter', 'dimensions', 'metrics', + 'intervals', 'limit', + ] + self.validate_query(query_type, valid_parts, args) + return self.build_query(query_type, args)