Search code examples
pythonsqlobject

Simple multi-threading with SQLObject doesn't work


It stucks once I execute .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()

Solution

  • Unfortunately the problem was not related to SQLObject or Python. It was probably my computer or my MySQL server. Sorry for misquestioning everybody.