<div dir="ltr">Thanks Oscar!<div><br></div><div>Your example worked perfectly. Now I am thinking on making a method in the User model called something like "asdictionary()" which I would call to get the dictionary version of a particular User object -of course without the references, I would have to investigate how to get the references and push them into the dictionary-.</div>
<div><br></div><div>So, another question came up; there is a datetime column called "updated" in the User model, with this code, if I access user_array["updated"] I get this:</div><div><br></div><div>'updated': datetime.datetime(2014, 4, 13, 10, 24, 28)  (which is not json serializable)<br>
</div><div><br></div><div>but if I access user.updated I will get: '2014-04-13 10:24:28' (which is json serializable)</div><div><br></div><div>Certainly I would have to convert the "dict" version to its corresponding datetime string representation to make it json serializable, but I wanted to know if there is something inside Storm that I would use to make this conversion?</div>
<div><br></div><div>Thanks again.</div><div>Kind regards.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-13 10:12 GMT-06:00 Oscar Campos <span dir="ltr"><<a href="mailto:oscar.campos@member.fsf.org" target="_blank">oscar.campos@member.fsf.org</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Hi.</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Let’s say that you have an User model:</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
user = store.find(User, User.email == ‘<a href="mailto:rpishcr@gmail.com" target="_blank">rpishcr@gmail.com</a>’).one()</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
user_array = dict([(<a href="http://p.name" target="_blank">p.name</a>, getattr(user, (<a href="http://p.name" target="_blank">p.name</a>))) for p in user._storm_columns.values()])</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Take into consideration that the former will work for simple properties, meaning that no references will be convert and returned as dictionary.</div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Regards</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <div><div style="font-family:helvetica,arial;font-size:13px">-- </div><div style="font-family:helvetica,arial;font-size:13px">
Join the free software foundation and become free as in freedom<br></div></div><div><div class="h5"> <br><p style>On 13 April 2014 at 07:37:08, R Pish (<a href="mailto:rpishcr@gmail.com" target="_blank">rpishcr@gmail.com</a>) wrote:</p>
 </div></div><blockquote type="cite"><span><div><div></div><div><div><div class="h5">






<div dir="ltr">Hi,
<div><br></div>
<div>What is the recommended way to convert a resultset produced by
a call like: store.find(User, User.id == myvarid).one() ?</div>
<div><br></div>
<div>Thanks in advance</div>
</div></div></div><span class="HOEnZb"><font color="#888888">


--  
<br>storm mailing list
<br><a href="mailto:storm@lists.canonical.com" target="_blank">storm@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></font></span></div></div></span></blockquote></div></blockquote></div><br></div>