sow-aggregated
Import the AMPS library:
import AMPS
Construct the command:
cmd = AMPS.Command(AMPS.Message.Command.SOW)
# set options
cmd.set_options(opts.Projection("/id as /id, COUNT(values) as /valueCount") + \
opts.Grouping("/id") )
# set the topic and ordering for the command
cmd.set_topic(topic).set_order_by("/id DESC")
The command can now be used in execute or execute_async.