Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'scan' queries #108

Merged
merged 1 commit into from
Jan 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)