ok<br>here is what i have for history<br>CREATE TABLE `history` (<br>&nbsp; `id` int(11) NOT NULL auto_increment,<br>&nbsp; `monitor` varchar(25) NOT NULL,<br>&nbsp; `function` varchar(25) NOT NULL,<br>&nbsp; `raw` float NOT NULL default &#39;0&#39;,
<br>&nbsp; `value` varchar(10) NOT NULL default &#39;0&#39;,<br>&nbsp; `date_time` datetime NOT NULL default &#39;0000-00-00 00:00:00&#39;,<br>&nbsp; `s_date_time` datetime NOT NULL default &#39;0000-00-00 00:00:00&#39;,<br>&nbsp; `sid` varchar(20) default &#39;0&#39;,
<br>&nbsp; `switch` varchar(20) default &#39;0&#39;,<br>&nbsp; PRIMARY KEY&nbsp; (`id`),<br>&nbsp; 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>&nbsp; `id` int(11) NOT NULL auto_increment,<br>&nbsp; `status_sensor_id` int(11) default NULL,<br>&nbsp; `raw` int(11) default NULL,<br>&nbsp; `value` varchar(10) default NULL,<br>&nbsp; `date_time` datetime NOT NULL default &#39;0000-00-00 00:00:00&#39;,
<br>&nbsp; `sensor_time` datetime NOT NULL default &#39;0000-00-00 00:00:00&#39;,<br>&nbsp; PRIMARY KEY&nbsp; (`id`),<br>&nbsp; KEY `sensor_id` (`status_sensor_id`,`date_time`),<br>&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __storm_table__ = &quot;status_hits&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; id = Int(primary = True)<br>&nbsp;&nbsp;&nbsp;&nbsp; status_sensor_id = Int()<br>&nbsp;&nbsp;&nbsp;&nbsp; raw, value = Float(), Unicode()<br>&nbsp;&nbsp;&nbsp;&nbsp; date_time = DateTime()
<br>&nbsp;&nbsp;&nbsp;&nbsp; sensor_time = DateTime()<br><br>&nbsp;class HistoryHit(object):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __storm_table__ = &quot;history&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; id = Int(primary = True)<br>&nbsp;&nbsp;&nbsp;&nbsp; monitor, function, value = Unicode(), Unicode(), Unicode()<br>&nbsp;&nbsp;&nbsp;&nbsp; raw = Float()
<br>&nbsp;&nbsp;&nbsp;&nbsp; date_time, s_date_time = DateTime(), DateTime()<br>&nbsp;&nbsp;&nbsp;&nbsp; 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> &lt;<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>&gt; 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">&nbsp;-------------- Original message ----------------------<br>From: &quot;shawn bright&quot; &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:nephish@gmail.com">
nephish@gmail.com</a>&gt;<br>&gt; Oh, yeah, sorry about the confusion there, the StatusHit is a different<br>&gt; class that points to a different table in the database.<br>&gt;<br>&gt; We have all these different types of sensors that report in. Status, Volts,
<br>&gt; Accumulators, Analog, etc...<br>&gt; for every sensor type there is a table StatusSenso = status_sensors,<br>&gt; VoltSensor = volt_sensors and so on ...<br>&gt;<br>&gt; each type of sensor has its own history table to log the report history for
<br>&gt; each.<br>&gt; so we have voltage_hits, status_hits, analog_hits, etc...<br>&gt;<br>&gt; HistoryHit, is a class that represents everything. &nbsp;Everthing that reports<br>&gt; goes into a history table ( currently 1.7
 GB )<br>&gt;<br>&gt; so if a status_sensor reports, there is an update to StatusSensor, a new<br>&gt; record in StatusHits, and a new record in history (HistoryHit).<br>&gt;<br>&gt; thanks<br>&gt;<br>&gt;<br>&gt;<br>&gt; On 8/7/07, Adrian Klaver &lt;
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; &nbsp;-------------- Original message ----------------------<br>&gt; &gt; From: &quot;shawn bright&quot; &lt;
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:nephish@gmail.com">nephish@gmail.com</a>&gt;<br>&gt; &gt; &gt; hello again,<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; i have a kinda different problem with and insert function i created.
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; here is the class<br>&gt; &gt; &gt; class HistoryHit(object):<br>&gt; &gt; &gt; &nbsp; &nbsp; __storm_table__ = &quot;history&quot;<br>&gt; &gt; &gt; &nbsp; &nbsp; id = Int(primary = True)<br>&gt; &gt; &gt; &nbsp; &nbsp; monitor, function, value = Unicode(), Unicode(), Unicode()
<br>&gt; &gt; &gt; &nbsp; &nbsp; raw = Float()<br>&gt; &gt; &gt; &nbsp; &nbsp; date_time, s_date_time = DateTime(), DateTime()<br>&gt; &gt; &gt; &nbsp; &nbsp; sid, switch = Unicode(), Unicode()<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; here is the function:
<br>&gt; &gt; &gt; def make_history(obj, function, s_time = &#39;none&#39;, sid=&#39;none&#39;,<br>&gt; &gt; switch=&#39;none&#39;):<br>&gt; &gt; &gt; &nbsp; &nbsp; print &#39;\n\n make history&#39;<br>&gt; &gt; &gt; &nbsp; &nbsp; print &#39;found object %s&#39; % 
obj.monitor<br>&gt; &gt; &gt; &nbsp; &nbsp; print &#39;found raw = %s&#39; % obj.last_raw<br>&gt; &gt; &gt; &nbsp; &nbsp; print &#39;type of raw = %s&#39; % type(obj.last_raw)<br>&gt; &gt; &gt; &nbsp; &nbsp; print &#39;found value = %s &#39; % obj.last_value
<br>&gt; &gt; &gt; &nbsp; &nbsp; store = Store.of(obj)<br>&gt; &gt; &gt; &nbsp; &nbsp; hit = HistoryHit()<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.monitor = obj.monitor<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.raw = Float(obj.last_raw)<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.value = unicode(
obj.last_value)<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.function = &nbsp;unicode(function)<br>&gt; &gt; &gt; &nbsp; &nbsp; if s_time == &#39;none&#39;: hit.s_date_time = datetime.datetime.now()<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.date_time = datetime.datetime.now
()<br>&gt; &gt; &gt; &nbsp; &nbsp; hit.sid, hit.switch = unicode(sid), unicode(switch)<br>&gt; &gt; &gt; &nbsp; &nbsp; store.add(hit)<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; the lines that call it:<br>&gt; &gt; &gt; status_sensor.last_raw = raw
<br>&gt; &gt; &gt; status_sensor.last_value = value<br>&gt; &gt; &gt; status_sensor.last_report = datetime.datetime.now()<br>&gt; &gt; &gt; hit = StatusHit()<br>&gt; &gt; &gt; hit.status_sensor_id = status_sensor.id<br>&gt; &gt; &gt; 
hit.raw = raw<br>&gt; &gt; &gt; hit.value = value<br>&gt; &gt; &gt; hit.date_time = datetime.datetime.now()<br>&gt; &gt; &gt; hit.sensor_time = sensor_time<br>&gt; &gt; &gt; self.store.add(hit)<br>&gt; &gt; &gt; make_history(status_sensor, &#39;orbcomm status&#39;, s_time = sensor_time)
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; INSERT INTO history (date_time, function, monitor, sid, switch, value)<br>&gt; &gt; &gt; VALUES (%s, %s, %s, %s, %s, %s) (datetime.datetime(2007, 8, 7, 11, 31,<br>&gt; &gt; 8,<br>&gt; &gt; &gt; 634691), u&#39;orbcomm status&#39;, u&#39;RNKE734X1&#39;, u&#39;none&#39;, u&#39;none&#39;, u&#39;r&#39;)
<br>&gt; &gt; &gt; 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>&gt; &gt; &gt; 32246084 ()<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; &nbsp;why isn&#39;t raw added to the insert into ? &nbsp;the rest of the info is<br>&gt; &gt; there,<br>&gt; &gt; &gt; but the raw is missing, it does show up in the terminal from the print
<br>&gt; &gt; &gt; statement though.<br>&gt; &gt; &gt; &nbsp;why is there a select on history after the insert ? Nothing else really<br>&gt; &gt; &gt; ever calls for it.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; thanks<br>&gt; &gt; &gt;
<br>&gt; &gt; &gt; shawn<br>&gt; &gt;<br>&gt; &gt; One problem is that you are showing the class HistoryHit() but using the<br>&gt; &gt; class StatusHit() to do the insert. The make_history function is using<br>&gt; &gt; HistoryHit() so you are looking at the results coming from two different
<br>&gt; &gt; classes.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; --<br>&gt; &gt; Adrian Klaver<br>&gt; &gt; <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:&nbsp;&quot;shawn bright&quot; &lt;<a href="mailto:nephish@gmail.com">nephish@gmail.com
</a>&gt;<br>To:&nbsp;&quot;Adrian Klaver&quot; &lt;<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>&gt;<br>Date:&nbsp;Tue, 7 Aug 2007 19:20:29 +0000<br>Subject:&nbsp;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.&nbsp; 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> &lt;<a href="mailto:aklaver@comcast.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
aklaver@comcast.net</a>&gt; 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;">&nbsp;-------------- Original message ----------------------<br>From: &quot;shawn bright&quot; &lt;<a href="mailto:nephish@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
nephish@gmail.com
</a>&gt;<br>&gt; hello again,<br>&gt;<br>&gt; i have a kinda different problem with and insert function i created.<br>&gt;<br>&gt; here is the class<br>&gt; class HistoryHit(object):<br>&gt; &nbsp; &nbsp; __storm_table__ = &quot;history&quot;
<br>&gt; &nbsp; &nbsp; id = Int(primary = True)<br>&gt; &nbsp; &nbsp; monitor, function, value = Unicode(), Unicode(), Unicode()<br>&gt; &nbsp; &nbsp; raw = Float()<br>&gt; &nbsp; &nbsp; date_time, s_date_time = DateTime(), DateTime()<br>&gt; &nbsp; &nbsp; sid, switch = Unicode(), Unicode()
<br>&gt;<br>&gt; here is the function:<br>&gt; def make_history(obj, function, s_time = &#39;none&#39;, sid=&#39;none&#39;, switch=&#39;none&#39;):<br>&gt; &nbsp; &nbsp; print &#39;\n\n make history&#39;<br>&gt; &nbsp; &nbsp; print &#39;found object %s&#39; % 
obj.monitor<br>&gt; &nbsp; &nbsp; print &#39;found raw = %s&#39; % obj.last_raw<br>&gt; &nbsp; &nbsp; print &#39;type of raw = %s&#39; % type(obj.last_raw)<br>&gt; &nbsp; &nbsp; print &#39;found value = %s &#39; % obj.last_value<br>&gt; &nbsp; &nbsp; store = Store.of

(obj)<br>&gt; &nbsp; &nbsp; hit = HistoryHit()<br>&gt; &nbsp; &nbsp; hit.monitor = obj.monitor<br>&gt; &nbsp; &nbsp; hit.raw = Float(obj.last_raw)<br>&gt; &nbsp; &nbsp; hit.value = unicode(obj.last_value)<br>&gt; &nbsp; &nbsp; hit.function = &nbsp;unicode(function)<br>&gt; &nbsp; &nbsp; if s_time == &#39;none&#39;: 
hit.s_date_time = datetime.datetime.now()<br>&gt; &nbsp; &nbsp; hit.date_time = datetime.datetime.now()<br>&gt; &nbsp; &nbsp; hit.sid, hit.switch = unicode(sid), unicode(switch)<br>&gt; &nbsp; &nbsp; store.add(hit)<br>&gt;<br>&gt;<br>&gt; the lines that call it:
<br>&gt; status_sensor.last_raw = raw<br>&gt; status_sensor.last_value = value<br>&gt; status_sensor.last_report = datetime.datetime.now()<br>&gt; hit = StatusHit()<br>&gt; hit.status_sensor_id = status_sensor.id<br>&gt; 
hit.raw = raw<br>&gt; hit.value = value<br>&gt; hit.date_time = datetime.datetime.now()<br>&gt; hit.sensor_time = sensor_time<br>&gt; self.store.add(hit)<br>&gt; make_history(status_sensor, &#39;orbcomm status&#39;, s_time = sensor_time)
<br>&gt;<br>&gt; INSERT INTO history (date_time, function, monitor, sid, switch, value)<br>&gt; VALUES (%s, %s, %s, %s, %s, %s) (datetime.datetime(2007, 8, 7, 11, 31, 8,<br>&gt; 634691), u&#39;orbcomm status&#39;, u&#39;RNKE734X1&#39;, u&#39;none&#39;, u&#39;none&#39;, u&#39;r&#39;)
<br>&gt; 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>&gt; 32246084 ()<br>&gt;<br>&gt;<br>&gt; &nbsp;why isn&#39;t raw added to the insert into ? &nbsp;the rest of the info is there,<br>&gt; but the raw is missing, it does show up in the terminal from the print<br>

&gt; statement though.<br>&gt; &nbsp;why is there a select on history after the insert ? Nothing else really<br>&gt; ever calls for it.<br>&gt;<br>&gt; thanks<br>&gt;<br>&gt; 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:&nbsp;&quot;shawn bright&quot; &lt;
<a href="mailto:nephish@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nephish@gmail.com</a>&gt;<br>To:&nbsp;storm &lt;<a href="mailto:storm@lists.canonical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
storm@lists.canonical.com</a>&gt;<br>Date:&nbsp;Tue, 7 Aug 2007 16:30:26 +0000<br>Subject:&nbsp;[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>&nbsp;&nbsp;&nbsp; __storm_table__ = &quot;history&quot;<br>&nbsp;&nbsp;&nbsp; id = Int(primary = True)
<br>
&nbsp;&nbsp;&nbsp; monitor, function, value = Unicode(), Unicode(), Unicode()<br>&nbsp;&nbsp;&nbsp; raw = Float()<br>&nbsp;&nbsp;&nbsp; date_time, s_date_time = DateTime(), DateTime()<br>&nbsp;&nbsp;&nbsp; sid, switch = Unicode(), Unicode()<br><br>here is the function:<br>def make_history(obj, function, s_time = &#39;none&#39;, sid=&#39;none&#39;, switch=&#39;none&#39;):
<br>&nbsp;&nbsp;&nbsp; print &#39;\n\n make history&#39;<br>&nbsp;&nbsp;&nbsp; print &#39;found object %s&#39; % obj.monitor<br>&nbsp;&nbsp;&nbsp; print &#39;found raw = %s&#39; % obj.last_raw<br>&nbsp;&nbsp;&nbsp; print &#39;type of raw = %s&#39; % type(obj.last_raw)<br>&nbsp;&nbsp;&nbsp; print &#39;found value = %s &#39; % 
obj.last_value<br>&nbsp;&nbsp;&nbsp; store = Store.of(obj)<br>&nbsp;&nbsp;&nbsp; hit = HistoryHit()<br>&nbsp;&nbsp;&nbsp; hit.monitor = obj.monitor <br>&nbsp;&nbsp;&nbsp; hit.raw = Float(obj.last_raw)<br>&nbsp;&nbsp;&nbsp; hit.value = unicode(obj.last_value)<br>&nbsp;&nbsp;&nbsp; hit.function =&nbsp; unicode(function)
<br>&nbsp;&nbsp;&nbsp; if s_time == &#39;none&#39;: hit.s_date_time = datetime.datetime.now()<br>&nbsp;&nbsp;&nbsp; hit.date_time = datetime.datetime.now()<br>&nbsp;&nbsp;&nbsp; hit.sid, hit.switch = unicode(sid), unicode(switch)<br>&nbsp;&nbsp;&nbsp; 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, &#39;orbcomm status&#39;, 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&#39;orbcomm status&#39;, u&#39;RNKE734X1&#39;, u&#39;none&#39;, u&#39;none&#39;, u&#39;r&#39;)<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>&nbsp;why isn&#39;t raw added to the insert into ?&nbsp; 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>&nbsp;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>