(self, aggregation_id)
Initialize the aggregation object from a saved aggregation.

        Args:
            aggregation_id: integer value for the stored
                aggregation (primary key).
Initialize the aggregation object from a saved aggregation.
Initialize the aggregation object from a saved aggregation .
def from_saved(self, aggregation_id):
        """Initialize the aggregation object from a saved aggregation.

        Args:
            aggregation_id: integer value for the stored
                aggregation (primary key).
        """
        resource_uri = 'sketches/{0:d}/aggregation/{1:d}/'.format(
            self._sketch.id, aggregation_id)
        self._resource_id = aggregation_id
        resource_data = self.api.fetch_resource_data(resource_uri)
        data = resource_data.get('objects', [None])[0]
        if not data:
            return

        self.aggregator_name = data.get('agg_type')
        self.type = 'stored'

        self._created_at = data.get('created_at', '')
        self._updated_at = data.get('updated_at', '')
        self._group_id = data.get('aggregationgroup_id')

        label_string = data.get('label_string', '')
        if label_string:
            self._labels = json.loads(label_string)
        else:
            self._labels = []

        chart_type = data.get('chart_type')
        param_string = data.get('parameters', '')
        if param_string:
            parameters = json.loads(param_string)
        else:
            parameters = {}

        self._parameters = parameters

        self._username = data.get('user', {}).get('username', 'System')
        self.resource_data = self._run_aggregator(
            aggregator_name=self.aggregator_name, parameters=parameters,
            chart_type=chart_type)
def from_saved ( self , aggregation_id ) : resource_uri = 'sketches/{0:d}/aggregation/{1:d}/' . format ( self . _sketch . id , aggregation_id ) self . _resource_id = aggregation_id resource_data = self . api . fetch_resource_data ( resource_uri ) data = resource_data . get ( 'objects' , [ None ] ) [ 0 ] if not data : return self . aggregator_name = data . get ( 'agg_type' ) self . type = 'stored' self . _created_at = data . get ( 'created_at' , '' ) self . _updated_at = data . get ( 'updated_at' , '' ) self . _group_id = data . get ( 'aggregationgroup_id' ) label_string = data . get ( 'label_string' , '' ) if label_string : self . _labels = json . loads ( label_string ) else : self . _labels = [ ] chart_type = data . get ( 'chart_type' ) param_string = data . get ( 'parameters' , '' ) if param_string : parameters = json . loads ( param_string ) else : parameters = { } self . _parameters = parameters self . _username = data . get ( 'user' , { } ) . get ( 'username' , 'System' ) self . resource_data = self . _run_aggregator ( aggregator_name = self . aggregator_name , parameters = parameters , chart_type = chart_type )