Yes, this answers my question exactly. <br><br>thanks much<br><br>shawn<br><br><div><span class="gmail_quote">On 7/27/07, <b class="gmail_sendername">Jamu Kakar</b> &lt;<a href="mailto:jamshed.kakar@canonical.com">jamshed.kakar@canonical.com
</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;">Hi Shawn,<br><br>Note: Please include <a href="mailto:storm@lists.canonical.com">
storm@lists.canonical.com</a> in your responses.<br><br>shawn bright wrote:<br>&gt; if i have a new object, and i need to know its id, because it is related<br>&gt; to another object, how do i get that id ? I would need to commit(), then
<br>&gt; re-select it ?<br><br>Nope, you don&#39;t need to commit for this case.&nbsp;&nbsp;For the most part, you<br>can just access the attribute and Storm will auto-flush the changes to<br>the database (without actually committing the changes).&nbsp;&nbsp;For example,
<br>the following should work:<br><br>class Person(Storm):<br><br>&nbsp;&nbsp;&nbsp;&nbsp;__storm_table__ = &quot;person&quot;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;id = Int(primary_key=True)<br>&nbsp;&nbsp;&nbsp;&nbsp;name = Unicode(allow_none=False)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;def __init__(self, name):
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://self.name">self.name</a> = name<br><br>class Account(Storm):<br><br>&nbsp;&nbsp;&nbsp;&nbsp;__storm_table__ = &quot;account&quot;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;id = Int(primary_key=True)<br>&nbsp;&nbsp;&nbsp;&nbsp;owner_id = Int()<br><br>&nbsp;&nbsp;&nbsp;&nbsp;owner = Reference(owner_id, 
<a href="http://Person.id">Person.id</a>)<br><br># We&#39;ll create an Account object and add it to a store.<br>account = store.add(Account())<br><br># Storm&#39;s auto-flushing capability with get an ID, if need be.<br>print 
<a href="http://account.id">account.id</a><br><br># The new person object will be automatically added to the store, by<br># way of association with the Account.<br>account.owner = Person(&quot;Bob&quot;)<br><br># Again, Storm&#39;s auto-flushing will get an ID, if necessary.
<br>print <a href="http://account.owner.id">account.owner.id</a><br><br>Does this answer your question?<br><br>Thanks,<br>J.<br></blockquote></div><br>