I have a problem while trying to use the "fromDatabase = True" option in sqlmeta. Any time I enable this. it gives me the connection error below. Is there another attribute I need to do before doing this? I saw another thread with this problem but the solution was enable the connection before the class which I have done.

from sqlobject import *

class Companys(SQLObject):
     def __init__(self):
        connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
        conn = connectionForURI(connection_string,debug = True,autoCommit = True)
        trans = conn.transaction()
        sqlhub.processConnection = conn
        Company.createTable(ifNotExists = True, connection=conn)
        Company._connection.debug = True
    
class Company(SQLObject):

    class sqlmeta:
       fromDatabase = True
       lazyUpdate = True
       cacheValues = True
 
    Company_Name = StringCol(length = 256, default = None)
    Company_Address = StringCol(length = 256, default = None)
    Company_Phone = StringCol(length = 256, default = None)

Traceback (most recent call last):
  File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in <module>
    from pySMS import Companys
  File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in <module>
    from Company import Companys
  File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 138, in <module>
    class Company(SQLObject):
  File "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py", line 92, in __new__
    cls.__classinit__(cls, new_attrs)
  File "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py", line 789, in __classinit__
    sqlmeta.addColumnsFromDatabase()
  File "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py", line 441, in addColumnsFromDatabase
    conn = connection or soClass._connection
  File "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py", line 902, in __get__
    return self.getConnection()
  File "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py", line 915, in getConnection
    "No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process