(
            self, name, agg_name, agg_params, description='', view_id=None,
            chart_type=None, label='')
return aggregation
Add aggregation to the sketch.

        Args:
            name: the name of the aggregation run.
            agg_name: the name of the aggregation class to run.
            agg_params: a dictionary of the parameters for the aggregation.
            description: description of the aggregation, visible in the UI,
                this is optional.
            view_id: optional ID of the view to attach the aggregation to.
            chart_type: string representing the chart type.
            label: string with a label to attach to the aggregation.
Add aggregation to the sketch.
Add aggregation to the sketch .
def add_aggregation(
            self, name, agg_name, agg_params, description='', view_id=None,
            chart_type=None, label=''):
        """Add aggregation to the sketch.

        Args:
            name: the name of the aggregation run.
            agg_name: the name of the aggregation class to run.
            agg_params: a dictionary of the parameters for the aggregation.
            description: description of the aggregation, visible in the UI,
                this is optional.
            view_id: optional ID of the view to attach the aggregation to.
            chart_type: string representing the chart type.
            label: string with a label to attach to the aggregation.
        """
        if not agg_name:
            raise ValueError('Aggregator name needs to be defined.')
        if not agg_params:
            raise ValueError('Aggregator parameters have to be defined.')

        if view_id:
            view = View.query.get(view_id)
        else:
            view = None

        if chart_type:
            agg_params['supported_charts'] = chart_type

        agg_json = json.dumps(agg_params)
        aggregation = Aggregation.get_or_create(
            name=name, description=description, agg_type=agg_name,
            parameters=agg_json, chart_type=chart_type, user=None,
            sketch=self.sql_sketch, view=view)

        if label:
            aggregation.add_label(label)
        db_session.add(aggregation)
        db_session.commit()
        return aggregation
def add_aggregation ( self , name , agg_name , agg_params , description = '' , view_id = None , chart_type = None , label = '' ) : if not agg_name : raise ValueError ( 'Aggregator name needs to be defined.' ) if not agg_params : raise ValueError ( 'Aggregator parameters have to be defined.' ) if view_id : view = View . query . get ( view_id ) else : view = None if chart_type : agg_params [ 'supported_charts' ] = chart_type agg_json = json . dumps ( agg_params ) aggregation = Aggregation . get_or_create ( name = name , description = description , agg_type = agg_name , parameters = agg_json , chart_type = chart_type , user = None , sketch = self . sql_sketch , view = view ) if label : aggregation . add_label ( label ) db_session . add ( aggregation ) db_session . commit ( ) return aggregation