>
> *from gluon.sql import DAL, Field*
> *db = DAL('mysql:mydatabase')*
>
> Done. But it seems to be empty, no tables remaining :(
> Even if I select the auth_user table: "*KeyError: 'auth_user*'"
>
After defining the "db" object, you have to define the tables as well --
otherwise, it doesn't know what tables are in the db. If the tables have
been defined elsewhere and you have the *.table files in the application's
/databases folder, you could do:
* *db = DAL('mysql:mydatabase', auto_import=True)
*
*
In that case, though, the table definitions won't include any of the
web2py-specific attributes, such as validators, default values, etc. See
http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables
.
Anthony