Hi,

I am a python and web2py newbie. Sorry in advance for the dumb question.

I am trying to use the following code

table=request.vars.table # This gives us the table name to query
query="db.%s.id>0" % (table) # this sets up the query

records=SQLTABLE(db(query).select()) # this should get us records.

But i get the folloeing error.

 File
"/usr/local/google/home/samit/web2py/applications/myapp/controllers/mytestcontroller.py",
line 27, in tracked_in_logs
   records=SQLTABLE(db(query).select())
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1901, in
select
   query = self._select(*fields, **attributes)
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1812, in
_select
   fields = [self._db[table].ALL for table in self._tables]
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 435, in
__getitem__
   return dict.__getitem__(self, str(key))
KeyError: 'db'

Is it a problem with getting the value of the variable 'query' not getting
expanded

--~--~---------~--~----~------------~-------~--~----~
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