[storm] another question regarding inserts

shawn bright nephish at gmail.com
Tue Aug 7 17:30:08 BST 2007


hello again,

i have a kinda different problem with and insert function i created.

here is the class
class HistoryHit(object):
    __storm_table__ = "history"
    id = Int(primary = True)
    monitor, function, value = Unicode(), Unicode(), Unicode()
    raw = Float()
    date_time, s_date_time = DateTime(), DateTime()
    sid, switch = Unicode(), Unicode()

here is the function:
def make_history(obj, function, s_time = 'none', sid='none', switch='none'):
    print '\n\n make history'
    print 'found object %s' % obj.monitor
    print 'found raw = %s' % obj.last_raw
    print 'type of raw = %s' % type(obj.last_raw)
    print 'found value = %s ' % obj.last_value
    store = Store.of(obj)
    hit = HistoryHit()
    hit.monitor = obj.monitor
    hit.raw = Float(obj.last_raw)
    hit.value = unicode(obj.last_value)
    hit.function =  unicode(function)
    if s_time == 'none': hit.s_date_time = datetime.datetime.now()
    hit.date_time = datetime.datetime.now()
    hit.sid, hit.switch = unicode(sid), unicode(switch)
    store.add(hit)


the lines that call it:
status_sensor.last_raw = raw
status_sensor.last_value = value
status_sensor.last_report = datetime.datetime.now()
hit = StatusHit()
hit.status_sensor_id = status_sensor.id
hit.raw = raw
hit.value = value
hit.date_time = datetime.datetime.now()
hit.sensor_time = sensor_time
self.store.add(hit)
make_history(status_sensor, 'orbcomm status', s_time = sensor_time)

INSERT INTO history (date_time, function, monitor, sid, switch, value)
VALUES (%s, %s, %s, %s, %s, %s) (datetime.datetime(2007, 8, 7, 11, 31, 8,
634691), u'orbcomm status', u'RNKE734X1', u'none', u'none', u'r')
SELECT history.id, history.s_date_time FROM history WHERE history.id =
32246084 ()


 why isn't raw added to the insert into ?  the rest of the info is there,
but the raw is missing, it does show up in the terminal from the print
statement though.
 why is there a select on history after the insert ? Nothing else really
ever calls for it.

thanks

shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20070807/8b559e67/attachment.htm 


More information about the storm mailing list