这个问题基于线程,因为我观察到 Storm 允许我重用我的 SQL 模式。
如何解决 Storm 中的以下错误消息?
该代码基于 Jason 的回答和 Storm 的手册。
import os, pg, sys, re, psycopg2, storm
from storm.locals import *
from storm import *
class Courses():
subject = Unicode()
database = create_database("postgres://naa:123@localhost:5432/tk")
store = Store(database)
course = Courses()
course.subject = 'abcd'
store.add(course)
它给你
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
File "/usr/lib/python2.6/dist-packages/storm/store.py", line 245, in add
obj_info = get_obj_info(obj)
File "/usr/lib/python2.6/dist-packages/storm/info.py", line 40, in get_obj_info
obj_info = ObjectInfo(obj)
File "/usr/lib/python2.6/dist-packages/storm/info.py", line 162, in __init__
self.cls_info = get_cls_info(type(obj))
File "/usr/lib/python2.6/dist-packages/storm/info.py", line 51, in get_cls_info
cls.__storm_class_info__ = ClassInfo(cls)
File "/usr/lib/python2.6/dist-packages/storm/info.py", line 69, in __init__
raise ClassInfoError("%s.__storm_table__ missing" % repr(cls))
storm.exceptions.ClassInfoError: <type 'instance'>.__storm_table__ missing
这向我表明缺少某些模块。Storm中没有模块instance
。