[storm] queries made to look for something storm already has

Gabriel Rossetti gabriel.rossetti at arimaz.com
Mon Jul 28 09:17:19 BST 2008


Hello everyone,

I turned on the debugging and I'm seeing queries like these :

INSERT INTO `language` (name) VALUES (%s) (u'ENGLISH',)
SELECT `language`.language_id FROM `language` WHERE 
`language`.language_id = 1 ()
INSERT INTO `language` (name) VALUES (%s) (u'FRENCH',)
SELECT `language`.language_id FROM `language` WHERE 
`language`.language_id = 2 ()

Why is a query made for `language`.language_id if we already have it 
(it's used in the WHERE statement)?

The code that generated this is :


class Language(Storm):
    __storm_table__ = "language"
   
    id = Int(primary=True, name="language_id")
    name = Unicode()
   
    def __init__(self, name):
        self.name = name

#
# Create the test languages
#
lang1 = Language(u"ENGLISH")
store.add(lang1)
lang2 = Language(u"FRENCH")
store.add(lang2)
store.flush()


Thank you,
Gabriel



More information about the storm mailing list