druid-io / pydruid

A Python connector for Druid
Other
507 stars 198 forks source link

Support for dimensions specs at query time #40

Closed se7entyse7en closed 8 years ago

se7entyse7en commented 8 years ago

Adds support for dimensions specs at query time for the following extraction functions:

With these merge is it possible to pass as dimensions both raw strings both DimensionSpec objects.

Example usage with regex extraction function:

from pydruid.utils import dimensions
...

group = query.groupby(
            dataSource='mydatasource',
            granularity='hour',
            intervals='2013-10-04/pt1h',
            dimensions=['year', dimensions.DimensionSpec(
                'full_name', 'first_name', extraction_function=dimensions.RegexExtraction(r'(\w).*')],
            aggregations={'count': doublesum('count')}
)
fjy commented 8 years ago

:+1:

@drcrallen @xvrl please review