tempodb / tempodb-python

Python client for TempoDB
MIT License
28 stars 19 forks source link

Write demo is incorrect #1

Closed wrightd closed 12 years ago

wrightd commented 12 years ago

It looks like your write demo script is outdated (doesn't use DataPoint properly) I had to update it as follows for it to work:

import datetime import random from tempodb import Client, DataPoint

client = Client('xyz', 'abc')

date = datetime.datetime(2012, 1, 1)

for day in range(1, 10):

print out the current day we are sending data for

print date
data = []
#1440 minutes in one day
for min in range (1, 1441):
    data.append(DataPoint(date, random.random() * 50.0))

    date = date + datetime.timedelta(minutes=1)

client.write_key('mykey', data)