![](/img/trans.png)
[英]why doesn't a simple python producer/consumer multi-threading program speed up by adding the number of workers?
[英]Simple multi-threading with SQLObject doesn't work
一旦执行.getOne()
它就会.getOne()
:
from sqlobject import *
import threading
sqlhub.processConnection = connectionForURI('mysql://user:password@localhost:3306/database')
class Player(SQLObject):
name = StringCol(length=64)
last_login = DateTimeCol()
create_date = DateTimeCol(default=DateTimeCol.now)
def act():
result = Player.selectBy(name='Zippo')
player = result.getOne()
print 'You will never see this message in console.'
threading.Thread(target=act).start()
getOne可能跌倒了,而您只是没有看到异常? 在这种情况下,您可以将默认结果指定为参数,也可以将其放在try / except子句中。
如果在调试器中运行它会怎样?
由于我们不知道您数据库中的内容,因此此处没有太多信息。
不幸的是,问题与SQLObject或Python无关。 可能是我的计算机或MySQL服务器。 对不起大家的提问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.