db=SQLDB(...)

## start of missing part
db.define_table('tblAccounts',....)
## end of missing part

db(....).select(db.tblAccounts,....)

You need to define in the model the tables you are using else web2py
does not know about them.
If the table is prehexisting:

db.define_table('tblAccounts',....,migrate=False)

Massimo

On Jan 16, 9:04 am, Erik Telford <etelf...@gmail.com> wrote:
> I am attempting to connect to a mysql db using the following:
>
> def mydb():
>    db = SQLDB("mysql://user:passw...@localhost:3306/thedbname")
>    r = db().select(db.tblAccounts.ALL)
>    return r
>
> however, I receive this error:
>
> KeyError: 'tblAccounts'
>
> I am able to make the db connection and I can successfully able to use
> sqlexecute to perform the following SELECT.
>
> def mydb():
>    db = SQLDB("mysql://user:passw...@localhost:3306/thedbname")
>    r = db.executesql('select * from tblAccounts')
>    return r
>
> I've tried different variations on my first def, but with no luck.
> Where am I going wrong in my first bit of code?
>
> Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to