Skip to content

Commit

Permalink
Add support for 'scan' queries (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Jan 6, 2018
1 parent e8d978b commit bdf6bac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pydruid/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down Expand Up @@ -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)

0 comments on commit bdf6bac

Please sign in to comment.