Skip to content

Commit

Permalink
Merge pull request #29 from jreese/groupby
Browse files Browse the repository at this point in the history
Support multiple fields in --group-by
  • Loading branch information
lebinh committed Apr 9, 2014
2 parents 7b154b1 + a546be9 commit e409482
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ngxtop/ngxtop.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def __init__(self, report_queries, fields, index_fields=None):
def process(self, records):
self.begin = time.time()
insert = 'insert into log (%s) values (%s)' % (self.column_list, self.holder_list)
logging.info('sqlite insert: %s', insert)
with closing(self.conn.cursor()) as cursor:
for r in records:
cursor.execute(insert, r)
Expand Down Expand Up @@ -300,7 +301,12 @@ def build_processor(arguments):

for label, query in report_queries:
logging.info('query for "%s":\n %s', label, query)
processor = SQLProcessor(report_queries, fields)

processor_fields = []
for field in fields:
processor_fields.extend(field.split(','))

processor = SQLProcessor(report_queries, processor_fields)
return processor


Expand Down

0 comments on commit e409482

Please sign in to comment.