[storm] dicts and things

mark.a.brand mark.a.brand at gmail.com
Wed Mar 12 06:11:11 GMT 2008


hi:

*** newbie-alert ***:  both python and storm

the bit of code below - apparently works in sqlalchemy with sqlalchemy
syntax of course.

my question is how can i do the same thing in storm, ie create a whole bunch
or instances at once via a dict.

database = create_database("sqlite:hc.db")
store = Store(database)

class Process(Storm):
    __storm_table__ = "process"
    ProcessId = Int(primary = True)
    Caption = Unicode()

store.execute("CREATE TABLE process " "( \
ProcessId        VARCHAR, \
Caption            VARCHAR)",
noresult = True \
)

c = wmi.WMI ()
for process in c.Win32_Process (['ProcessId', 'Caption']):
    d = dict ((p, getattr (process, p)) for p in process.properties)
    Process (**d)

storm.flush()
storm.commit()

thanks
mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20080312/b981c650/attachment.htm 


More information about the storm mailing list