cubes_lite/sql/functions.py
def apply(self, aggregate, context, coalesce=False):
        """Apply the function on the aggregate. Subclasses might override this
        method and use other `aggregates` and browser context.

        If `missing_value` is not `None`, then the aggregate's source value
        should be wrapped in ``COALESCE(column, missing_value)``.

        Returns a SQLAlchemy expression."""

        if not aggregate.depends_on:
            raise ModelError(
                'No dpendants specified for aggregate "{}", '
                'required for function "{}"'
                .format(aggregate, self.name)
            )

        if len(aggregate.depends_on) < self.min_args_count:
            raise ModelError(
                'Not enough dependants for aggregate "{}", '
                'function "{}", need at least "{}"'
                .format(aggregate, self.name, self.min_args_count)
            )

        columns = [
            context[a]
            for a in aggregate.depends_on[:self.min_args_count]
        ]

        if coalesce and self._coalesce_args:
            columns = self.coalesce_args(aggregate, columns)

        expression = self.action(*columns)

        if coalesce and self._coalesce_result:
            expression = self.coalesce_aggregate(aggregate, expression)

        return expression
Apply the function on the aggregate. Subclasses might override this
        method and use other `aggregates` and browser context.

        If `missing_value` is not `None`, then the aggregate's source value
        should be wrapped in ``COALESCE(column, missing_value)``.

        Returns a SQLAlchemy expression.
Apply the function on the aggregate. Subclasses might override this
method and use other `aggregates` and browser context.



Returns a SQLAlchemy expression.
Apply the function on the aggregate . Subclasses might override this method and use other ` aggregates ` and browser context . Returns a SQLAlchemy expression .
def apply(self, aggregate, context, coalesce=False):
        if not aggregate.depends_on:
            raise ModelError(
                'No dpendants specified for aggregate "{}", '
                'required for function "{}"'
                .format(aggregate, self.name)
            )
        if len(aggregate.depends_on) < self.min_args_count:
            raise ModelError(
                'Not enough dependants for aggregate "{}", '
                'function "{}", need at least "{}"'
                .format(aggregate, self.name, self.min_args_count)
            )
        columns = [
            context[a]
            for a in aggregate.depends_on[:self.min_args_count]
        ]
        if coalesce and self._coalesce_args:
            columns = self.coalesce_args(aggregate, columns)
        expression = self.action(*columns)
        if coalesce and self._coalesce_result:
            expression = self.coalesce_aggregate(aggregate, expression)
        return expression
def apply ( self , aggregate , context , coalesce = False ) : if not aggregate . depends_on : raise ModelError ( 'No dpendants specified for aggregate "{}", ' 'required for function "{}"' . format ( aggregate , self . name ) ) if len ( aggregate . depends_on ) < self . min_args_count : raise ModelError ( 'Not enough dependants for aggregate "{}", ' 'function "{}", need at least "{}"' . format ( aggregate , self . name , self . min_args_count ) ) columns = [ context [ a ] for a in aggregate . depends_on [ : self . min_args_count ] ] if coalesce and self . _coalesce_args : columns = self . coalesce_args ( aggregate , columns ) expression = self . action ( * columns ) if coalesce and self . _coalesce_result : expression = self . coalesce_aggregate ( aggregate , expression ) return expression
Apply the function on the aggregate.
Apply the function on the aggregate .
"""Apply the function on the aggregate. Subclasses might override this
        method and use other `aggregates` and browser context.

        If `missing_value` is not `None`, then the aggregate's source value
        should be wrapped in ``COALESCE(column, missing_value)``.

        Returns a SQLAlchemy expression."""
self
aggregate
context
coalesce