Comment 1 for bug 1035162

Revision history for this message
James Henstridge (jamesh) wrote :

The code fragment you've listed in the description looks a bit weird to me:

    store = store.find(models.customer.Store, models.customer.Store.id == contract.store_id).one()

When this is executed, presumably "store" is a storm.store.Store instance. After it executes, it will be a models.customer.Store instance. While there is nothing stopping you doing this kind of thing in Python, it does make it more difficult to debug or understand the code.

So in the next query, you're executing the models.customer.Store.find() method instead of storm.store.Store.find(). You haven't included any information about that class in your code snippet, so it is difficult to tell what it might be doing.

Looking at the resulting SQL though, it appears that the first argument is being treated as part of the where clause (hence the table name appearing bare). Storm does have a few find() methods that act similar to this by not taking the first argument of Store.find() such as ResultSet.find() and BoundReferenceSet.find() (both of which use the same class list as the container they act on). Perhaps you used one of those?