Re: SqlObject Sqlmeta fromDatabase problem

Jeremy Hoyle <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CAJPMze+PVZ=FdT8V22Hy=nb+q4wh4xsW5zwJNR+_SL1M8jXvrw@mail.gmail.com>
Yes. If I remove Companys as a SQLObject.I still receive the same error.
I'm not sure from the sequence of the ( from Company import Companys ) is
trying to initiate (  class Company(SQLObject) ) class.

class Companys():
    def __init__(self):
       connection_string = 'mysql://root:[email protected]:3306/pySMS'
       conn = connectionForURI(connection_string,debug = True,autoCommit =
True)
       trans = conn.transaction()
       sqlhub.processConnection = conn
       Company.createTable(ifNotExists = True, connection=trans)

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 137, 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

On Mon, Mar 26, 2012 at 7:47 AM, Oleg Broytman <[email protected]> wrote:

> On Mon, Mar 26, 2012 at 07:42:40AM -0500, Jeremy Hoyle wrote:
> > *Companys is not a sqlobject table. Company is a sqlobject table.
> >
> > class Companys(SQLObject):
>
>   I clearly see here that Companys is an SQLObject and hence require a
> connection.
>
> Oleg.
> --
>     Oleg Broytman            http://phdru.name/            [email protected]
>           Programmers don't die, they just GOSUB without RETURN.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> sqlobject-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.