Excellent. Thanks, Massimo. I'm new to this for sure. Can you delete my first post on this subject for future readers? It didn't post before I reposted this one an hour later so I thought my first one didn't work.
Thanks again, ET On Jan 16, 9:22 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > 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 -~----------~----~----~----~------~----~------~--~---