Skip to content

Instantly share code, notes, and snippets.

@samdjohnson
Created October 15, 2014 16:09
Show Gist options
  • Save samdjohnson/b39e314e5861ce58b046 to your computer and use it in GitHub Desktop.
Save samdjohnson/b39e314e5861ce58b046 to your computer and use it in GitHub Desktop.
An example of TempoIQ's aggregate function with the python SDK.
session = get_session('tempo-iq-backend-url', key, secret)
start_time = datetime.datetime(2014,1,1,0,0,0,0)
end_time = datetime.datetime(2014,1,2,0,0,0,0)
results = session.query(Device)
.filter(Device[‘building’] == 1)
.filter(Sensor.key == “temp”)
.interpolate(“linear”, “PT15M”)
.aggregate(“avg”)
.read(start=start_time, end=end_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment