> >>> db = DAL('sqlite://aubop.db')
> >>> db.tables
> []
> That's strange, isn't it?

this is fine. In fact even if the tables are in db, web2py does not
discover them. You still need db.define_table(...) to inform web2py
about them.

I cannot say about the problem with the app, but could it be related
to this?

Massimo


On Aug 30, 7:56 am, Benjamin Goll <beni.g...@googlemail.com> wrote:
> Hi there,
>
> first of all I would like to thank you for this great software! It's
> just so much fun to create powerful applications with it!
>
> Unfortunately I ran into a really strange problem which I'm not able
> to solve.
>
> In the file models/database.py I define the following:
>
> db = DAL('sqlite://aubop.db')
> db.define_table('track', Field('title'), Field('artist'),
> Field('length'), Field('filepath'))
> db.define_table('album', Field('title'), Field('artist'),
> Field('tracks', 'list:reference track'), Field('currentTrack',
> 'reference track'), Field('currentPlaybackTime'), Field('rating',
> 'integer'))
>
> When I then try to access one of the two defined tables in a
> controller, I receive a KeyError, telling me, that e.g. db.album
> cannot be found.
> When I open the database "aubop.db" manually via the commandline-
> interface of sqlite3, I can see that the two tables have been created
> in the database:
>
> sqlite3 aubop.db
> sqlite> .tables
> album  track
>
> The sql.log also tells me that the tables ahve been created
> successfully.
>
> I then started web2py in the shell-mode ("python web2py.py -S aubop -
> M"):
>
> >>> db.tables
>
> ['auth_user', 'auth_group', 'auth_membership', 'auth_permission',
> 'auth_event']>>> db = DAL('sqlite://aubop.db')
> >>> db.tables
>
> []
>
> That's strange, isn't it?
>
> Is there anybody who could help me?
>
> Btw. access to a different sqlite-database works like a charm in a
> second application I've created earlier.
>
> Thanks in advance!
>
> Regards
>
> Benjamin

Reply via email to