In the DB I am accessing the data is distributed into tables with the same
structure but different names.
With the parameters received in the HTTP request I can obtain the table
name I have to use (I have something like an "index" for this)
How can I use the table in web2py when its name is in a variable? I'm
trying to avoid writing raw SQL queries.
I have found "with_alias" but I think I can't apply it here.
For example, based on the parameters received I obtain that the query must
be made to table named 'table123', and I set variable mytable='table123'.
I can define the model like this using the variable mytable:
db.define_table(mytable, Field('myfield'))
I cannot use db().select(db.table123.ALL) because I dont' know the table
name when I write the python code.
And I cannot use db().select(db.mytable.ALL) because mytable is the
variable with the table name, not the name of the table.
Is there an alternate syntax to access the table whose name is in a
variable?
Thanks in advance, regards