Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database
Hi there,
Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.
Thank you very much for your help, I highly appreciated it and learned another experience with storm 
Cheers,
On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu
<msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem
so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )
Thanks
On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu
<msh.computing <at> gmail.com> wrote:
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.
If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.
I tried to use find in getone method - no change
Tried to invalidate the pt after saving the id key, then get the Product using that id key and change its product_discount_id, - no change
Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error
Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem
Cheers,
On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl
<gerdusvanzyl <at> gmail.com> wrote:
in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)
I don't think that you can have two definition of the primary key that are different;
and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find
Hello,
I have a simple script (attached to this email )- and evrytime I run, i got
stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
return function(*args, **kwargs)
Traceback (most recent call last):
File "bulk_price_update.py", line 137, in <module>
process()
File "bulk_price_update.py", line 129, in process
new_pt.product_discount_id =
new_pd.id; store.flush()
File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
return obj_info.variables[column].get()
File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
self.event.emit("resolve-lazy-value", self, self._lazy_value)
File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
if callback(owner, *(args+data)) is False:
File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
result, result.get_one())
File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)
I am stuck at new idea to fix it, please help
If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the pt object, but then try to get a product again using
pt.id, however it does not help in both cases.
The DB is VirutalMart DB if it helps
Many thanks in advance
--
Steve Kieu
--
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
--
Gerdus van Zyl
http://about.me/gerdus
--
Steve Kieu
--
Steve Kieu
--
Steve Kieu
<div>
<p>Hi there,<br><br>Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.<br><br>Thank you very much for your help, I highly appreciated it and learned another experience with storm
<br><br>Cheers,<br><br><br><br><br></p>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu <span dir="ltr"><<a href="mailto:msh.computing@...">msh.computing@...</a>></span> wrote:<br><blockquote class="gmail_quote">
<br>I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem <br><br>so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )<br><br>Thanks<div>
<div></div>
<div class="h5">
<br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <span dir="ltr"><<a href="mailto:msh.computing@..." target="_blank">msh.computing <at> gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote">
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.<br><br>If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.<br><br>I tried to use find in getone method - no change<br><br>Tried to invalidate the pt after saving the id key, then get the Product using that id key and change its product_discount_id, - no change<br><br>Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error<br><br>Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem <br><br><br><br>Cheers,<div>
<div></div>
<div>
<br><br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <span dir="ltr"><<a href="mailto:gerdusvanzyl@..." target="_blank">gerdusvanzyl <at> gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote">
in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br><div class="gmail_quote">
<div>
<div></div>
<div>
On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr"><<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>></span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote">
<div>
<div></div>
<div>Hello,<div><br></div>
<div>I have a simple script (attached to this email )- and evrytime I run, i got</div>
<div><br></div>
<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div> return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>
<div> File "bulk_price_update.py", line 137, in <module></div>
<div> process()</div>
<div> File "bulk_price_update.py", line 129, in process</div>
<div> new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>
<div> File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div> return obj_info.variables[column].get()</div>
<div> File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>
<div> self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div> File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div> if callback(owner, *(args+data)) is False:</div>
<div> File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div> result, result.get_one())</div>
<div> File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>
<div> raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>
<div><br></div>
<div>If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>
<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>
</div>
</div>--<br>
storm mailing list<br><a href="mailto:storm@..." target="_blank">storm <at> lists.canonical.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Steve Kieu<br>
</div>