[storm] storm Digest, Vol 36, Issue 3
Jorge Sierra
asierra01 at gmail.com
Fri May 28 17:09:34 BST 2010
On the Json+Storm thing
from storm.locals import *
from storm.info import *
from storm.properties import *
import json
class Products(object):
__storm_table__ = "products"
__storm_primary__ = "lProductId"
strName = Unicode(name = 'NAME')
lProductId = Int (name = 'PRODUCTID')
lVendorId = Int (name = 'VENDORID')
m_strBarCode = Unicode(name = 'BARCODE')
strUnit = Unicode(name =
'UNIT') #; // Way the item is messure
# blah blah blah a bunch of fields
def __init__(self):
print self
def PrintProductsJson():
AllProducts = store.find(Products)
print AllProducts.count()
for products in AllProducts:
# here I am printing a json string
# it looks like a lot of work.... but it works
# I guess you can create a dictionary with matching json id I will
return with the data
print json.dumps({'PRODUCTID': products.lProductId,
'NAME': products.strName,
'MODIFDATE':
products.strLastDateModified.strftime('%Y-%m-%dT%H:%M:%S')})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20100528/7dcbfbd8/attachment-0001.htm
More information about the storm
mailing list