On Mon, Feb 02, 2009 at 09:55:35PM +0100, Stef Mientki wrote:
> I started with SQLObject because in general it's decribed as "easier".
Welcome!
> So I started here:
>
> http://www.sqlobject.org/SQLObject.html
>
> The first problem is that the first example already contains an error (
> at least that's what I guess)
>
> connection_string = 'sqlite:' + db_filename
>
> I think there's a slash missing ?
Yes. Thank you!
> Now the second problem is,
> that I want to start with an existing database:
>
> So this is my code:
>
> from sqlobject import *
> class Test_Create2 ( SQLObject ) :
> class sqlmeta :
> print 'piep'
> fromDatabase = True
>
> if __name__ == '__main__':
> DataBase_Name = 'D:/Data_Python_25/support/test_vl.db'
> sqlhub.processConnection = connectionForURI ( 'sqlite:/' +
> DataBase_Name )
> Test_Create2.createTable ()
>
> and this the error I get:
> Traceback (most recent call last):
[skip]
> "No connection has been defined for this thread "
> AttributeError: No connection has been defined for this thread or process
fromDatabase works at the class creation time and hence requires that
the connection is created before the class is being created:
sqlhub.processConnection = connectionForURI(...)
class Test_Create2(SQLObject):
...
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|