ok<br>here is what i have for history<br>CREATE TABLE `history` (<br> `id` int(11) NOT NULL auto_increment,<br> `monitor` varchar(25) NOT NULL,<br> `function` varchar(25) NOT NULL,<br> `raw` float NOT NULL default '0',
<br> `value` varchar(10) NOT NULL default '0',<br> `date_time` datetime NOT NULL default '0000-00-00 00:00:00',<br> `s_date_time` datetime NOT NULL default '0000-00-00 00:00:00',<br> `sid` varchar(20) default '0',
<br> `switch` varchar(20) default '0',<br> PRIMARY KEY (`id`),<br> KEY `monitor` (`monitor`)<br>) ENGINE=MyISAM AUTO_INCREMENT=32268398 DEFAULT CHARSET=latin1 AUTO_INCREMENT=32268398 ;<br><br><br>and status_hits
<br>CREATE TABLE `status_hits` (<br> `id` int(11) NOT NULL auto_increment,<br> `status_sensor_id` int(11) default NULL,<br> `raw` int(11) default NULL,<br> `value` varchar(10) default NULL,<br> `date_time` datetime NOT NULL default '0000-00-00 00:00:00',
<br> `sensor_time` datetime NOT NULL default '0000-00-00 00:00:00',<br> PRIMARY KEY (`id`),<br> KEY `sensor_id` (`status_sensor_id`,`date_time`),<br> KEY `date_time` (`date_time`)<br>) ENGINE=MyISAM AUTO_INCREMENT=17061974 DEFAULT CHARSET=latin1 AUTO_INCREMENT=17061974 ;
<br><br><br>And the classes<br><br>class StatusHit(Storm):<br> __storm_table__ = "status_hits"<br> id = Int(primary = True)<br> status_sensor_id = Int()<br> raw, value = Float(), Unicode()<br> date_time = DateTime()
<br> sensor_time = DateTime()<br><br> class HistoryHit(object):<br> __storm_table__ = "history"<br> id = Int(primary = True)<br> monitor, function, value = Unicode(), Unicode(), Unicode()<br> raw = Float()
<br> date_time, s_date_time = DateTime(), DateTime()<br> sid, switch = Unicode(), Unicode()<br><br>hope this helps<br>and thanks for the attention for this.<br><br>shawn<br><br><br><div><span class="gmail_quote">On 8/7/07,
<b class="gmail_sendername">Adrian Klaver</b> <<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="direction: ltr;"><br><br>--<br></div><div style="direction: ltr;"><span class="q">Adrian Klaver<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:aklaver@comcast.net">aklaver@comcast.net
</a><br><br></span></div><div style="direction: ltr;"><span class="e" id="q_11441f29714a8cf1_2"> -------------- Original message ----------------------<br>From: "shawn bright" <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:nephish@gmail.com">
nephish@gmail.com</a>><br>> Oh, yeah, sorry about the confusion there, the StatusHit is a different<br>> class that points to a different table in the database.<br>><br>> We have all these different types of sensors that report in. Status, Volts,
<br>> Accumulators, Analog, etc...<br>> for every sensor type there is a table StatusSenso = status_sensors,<br>> VoltSensor = volt_sensors and so on ...<br>><br>> each type of sensor has its own history table to log the report history for
<br>> each.<br>> so we have voltage_hits, status_hits, analog_hits, etc...<br>><br>> HistoryHit, is a class that represents everything. Everthing that reports<br>> goes into a history table ( currently 1.7
GB )<br>><br>> so if a status_sensor reports, there is an update to StatusSensor, a new<br>> record in StatusHits, and a new record in history (HistoryHit).<br>><br>> thanks<br>><br>><br>><br>> On 8/7/07, Adrian Klaver <
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>> wrote:<br>> ><br>> > -------------- Original message ----------------------<br>> > From: "shawn bright" <
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:nephish@gmail.com">nephish@gmail.com</a>><br>> > > hello again,<br>> > ><br>> > > i have a kinda different problem with and insert function i created.
<br>> > ><br>> > > here is the class<br>> > > class HistoryHit(object):<br>> > > __storm_table__ = "history"<br>> > > id = Int(primary = True)<br>> > > monitor, function, value = Unicode(), Unicode(), Unicode()
<br>> > > raw = Float()<br>> > > date_time, s_date_time = DateTime(), DateTime()<br>> > > sid, switch = Unicode(), Unicode()<br>> > ><br>> > > here is the function:
<br>> > > def make_history(obj, function, s_time = 'none', sid='none',<br>> > switch='none'):<br>> > > print '\n\n make history'<br>> > > print 'found object %s' %
obj.monitor<br>> > > print 'found raw = %s' % obj.last_raw<br>> > > print 'type of raw = %s' % type(obj.last_raw)<br>> > > print 'found value = %s ' % obj.last_value
<br>> > > store = Store.of(obj)<br>> > > hit = HistoryHit()<br>> > > hit.monitor = obj.monitor<br>> > > hit.raw = Float(obj.last_raw)<br>> > > hit.value = unicode(
obj.last_value)<br>> > > hit.function = unicode(function)<br>> > > if s_time == 'none': hit.s_date_time = datetime.datetime.now()<br>> > > hit.date_time = datetime.datetime.now
()<br>> > > hit.sid, hit.switch = unicode(sid), unicode(switch)<br>> > > store.add(hit)<br>> > ><br>> > ><br>> > > the lines that call it:<br>> > > status_sensor.last_raw = raw
<br>> > > status_sensor.last_value = value<br>> > > status_sensor.last_report = datetime.datetime.now()<br>> > > hit = StatusHit()<br>> > > hit.status_sensor_id = status_sensor.id<br>> > >
hit.raw = raw<br>> > > hit.value = value<br>> > > hit.date_time = datetime.datetime.now()<br>> > > hit.sensor_time = sensor_time<br>> > > self.store.add(hit)<br>> > > make_history(status_sensor, 'orbcomm status', s_time = sensor_time)
<br>> > ><br>> > > INSERT INTO history (date_time, function, monitor, sid, switch, value)<br>> > > VALUES (%s, %s, %s, %s, %s, %s) (datetime.datetime(2007, 8, 7, 11, 31,<br>> > 8,<br>> > > 634691), u'orbcomm status', u'RNKE734X1', u'none', u'none', u'r')
<br>> > > SELECT <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://history.id" target="_blank">history.id</a>, history.s_date_time FROM history WHERE <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://history.id" target="_blank">
history.id</a> =<br>> > > 32246084 ()<br>> > ><br>> > ><br>> > > why isn't raw added to the insert into ? the rest of the info is<br>> > there,<br>> > > but the raw is missing, it does show up in the terminal from the print
<br>> > > statement though.<br>> > > why is there a select on history after the insert ? Nothing else really<br>> > > ever calls for it.<br>> > ><br>> > > thanks<br>> > >
<br>> > > shawn<br>> ><br>> > One problem is that you are showing the class HistoryHit() but using the<br>> > class StatusHit() to do the insert. The make_history function is using<br>> > HistoryHit() so you are looking at the results coming from two different
<br>> > classes.<br>> ><br>> ><br>> > --<br>> > Adrian Klaver<br>> > <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:aklaver@comcast.net">aklaver@comcast.net</a><br>
<br></span></div><div style="direction: ltr;">I inadvertently replied to Shawn only in my original response. I am bringing this thread<br>back to the list. At this point I do not have an answer for why the raw value is not showing
<br>up. It would be nice to see the schema for the History and StatusHit tables.<br><br></div><br><br>---------- Forwarded message ----------<br>From: "shawn bright" <<a href="mailto:nephish@gmail.com">nephish@gmail.com
</a>><br>To: "Adrian Klaver" <<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>><br>Date: Tue, 7 Aug 2007 19:20:29 +0000<br>Subject: Re: [storm] another question regarding inserts<br>Oh, yeah, sorry about the confusion there, the StatusHit is a different class that points to a different table in the database.
<br><br>We have all these different types of sensors that report in. Status, Volts, Accumulators, Analog, etc...
<br>for every sensor type there is a table StatusSenso = status_sensors, VoltSensor = volt_sensors and so on ... <br><br>each type of sensor has its own history table to log the report history for each. <br>so we have voltage_hits, status_hits, analog_hits, etc...
<br><br>HistoryHit, is a class that represents everything. Everthing that reports goes into a history table ( currently 1.7 GB )<br><br>so if a status_sensor reports, there is an update to StatusSensor, a new record in StatusHits, and a new record in history (HistoryHit).
<br><br>thanks<br><br><br><br><div><span class="gmail_quote">On 8/7/07, <b class="gmail_sendername">Adrian Klaver</b> <<a href="mailto:aklaver@comcast.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
aklaver@comcast.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="direction: ltr;"> -------------- Original message ----------------------<br>From: "shawn bright" <<a href="mailto:nephish@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
nephish@gmail.com
</a>><br>> hello again,<br>><br>> i have a kinda different problem with and insert function i created.<br>><br>> here is the class<br>> class HistoryHit(object):<br>> __storm_table__ = "history"
<br>> id = Int(primary = True)<br>> monitor, function, value = Unicode(), Unicode(), Unicode()<br>> raw = Float()<br>> date_time, s_date_time = DateTime(), DateTime()<br>> sid, switch = Unicode(), Unicode()
<br>><br>> here is the function:<br>> def make_history(obj, function, s_time = 'none', sid='none', switch='none'):<br>> print '\n\n make history'<br>> print 'found object %s' %
obj.monitor<br>> print 'found raw = %s' % obj.last_raw<br>> print 'type of raw = %s' % type(obj.last_raw)<br>> print 'found value = %s ' % obj.last_value<br>> store = Store.of
(obj)<br>> hit = HistoryHit()<br>> hit.monitor = obj.monitor<br>> hit.raw = Float(obj.last_raw)<br>> hit.value = unicode(obj.last_value)<br>> hit.function = unicode(function)<br>> if s_time == 'none':
hit.s_date_time = datetime.datetime.now()<br>> hit.date_time = datetime.datetime.now()<br>> hit.sid, hit.switch = unicode(sid), unicode(switch)<br>> store.add(hit)<br>><br>><br>> the lines that call it:
<br>> status_sensor.last_raw = raw<br>> status_sensor.last_value = value<br>> status_sensor.last_report = datetime.datetime.now()<br>> hit = StatusHit()<br>> hit.status_sensor_id = status_sensor.id<br>>
hit.raw = raw<br>> hit.value = value<br>> hit.date_time = datetime.datetime.now()<br>> hit.sensor_time = sensor_time<br>> self.store.add(hit)<br>> make_history(status_sensor, 'orbcomm status', s_time = sensor_time)
<br>><br>> INSERT INTO history (date_time, function, monitor, sid, switch, value)<br>> VALUES (%s, %s, %s, %s, %s, %s) (datetime.datetime(2007, 8, 7, 11, 31, 8,<br>> 634691), u'orbcomm status', u'RNKE734X1', u'none', u'none', u'r')
<br>> SELECT <a href="http://history.id" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">history.id</a>, history.s_date_time FROM history WHERE <a href="http://history.id" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
history.id</a> =<br>> 32246084 ()<br>><br>><br>> why isn't raw added to the insert into ? the rest of the info is there,<br>> but the raw is missing, it does show up in the terminal from the print<br>
> statement though.<br>> why is there a select on history after the insert ? Nothing else really<br>> ever calls for it.<br>><br>> thanks<br>><br>> shawn<br><br>One problem is that you are showing the class HistoryHit() but using the
<br>class StatusHit() to do the insert. The make_history function is using<br>HistoryHit() so you are looking at the results coming from two different<br>classes.<br></div><div style="direction: ltr;"><span><br>
<br>--<br>Adrian Klaver<br><a href="mailto:aklaver@comcast.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">aklaver@comcast.net</a><br><br></span></div><br><br>---------- Forwarded message ----------
<br>From: "shawn bright" <
<a href="mailto:nephish@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nephish@gmail.com</a>><br>To: storm <<a href="mailto:storm@lists.canonical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
storm@lists.canonical.com</a>><br>Date: Tue, 7 Aug 2007 16:30:26 +0000<br>Subject: [storm] another question regarding inserts
<br>hello again, <br><br>i have a kinda different problem with and insert function i created.<br><br>here is the class<br>class HistoryHit(object):<br> __storm_table__ = "history"<br> id = Int(primary = True)
<br>
monitor, function, value = Unicode(), Unicode(), Unicode()<br> raw = Float()<br> date_time, s_date_time = DateTime(), DateTime()<br> sid, switch = Unicode(), Unicode()<br><br>here is the function:<br>def make_history(obj, function, s_time = 'none', sid='none', switch='none'):
<br> print '\n\n make history'<br> print 'found object %s' % obj.monitor<br> print 'found raw = %s' % obj.last_raw<br> print 'type of raw = %s' % type(obj.last_raw)<br> print 'found value = %s ' %
obj.last_value<br> store = Store.of(obj)<br> hit = HistoryHit()<br> hit.monitor = obj.monitor <br> hit.raw = Float(obj.last_raw)<br> hit.value = unicode(obj.last_value)<br> hit.function = unicode(function)
<br> if s_time == 'none': hit.s_date_time = datetime.datetime.now()<br> hit.date_time = datetime.datetime.now()<br> hit.sid, hit.switch = unicode(sid), unicode(switch)<br> store.add(hit)<br><br><br>the lines that call it:
<br>status_sensor.last_raw = raw<br>status_sensor.last_value = value<br>status_sensor.last_report = datetime.datetime.now()<br>hit = StatusHit()<br>hit.status_sensor_id = status_sensor.id<br>hit.raw = raw<br>hit.value = value
<br>hit.date_time = datetime.datetime.now()<br>hit.sensor_time = sensor_time<br>self.store.add(hit)<br>make_history(status_sensor, 'orbcomm status', s_time = sensor_time)<br><br>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')<br>SELECT <a href="http://history.id" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
history.id</a>, history.s_date_time FROM history WHERE
<a href="http://history.id" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">history.id</a> = 32246084 ()<br><br><br> 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.
<br> why is there a select on history after the insert ? Nothing else really ever calls for it.<br><br>thanks <br><br>shawn<br><br><br><br><br><br>
<br>--<br>storm mailing list<br><a href="mailto:storm@lists.canonical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">storm@lists.canonical.com</a><br>Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br></blockquote></div><br>
<br></blockquote></div><br>