You could always do the db.define_table calls specific to the tables
that are in the schema:

def define_schema1():
    db.define_table("table1")
    # and so forth

def define_schema1():
    db.define_table("tablea")
    # and so forth

# later on... (after changing the schema)

if current_schema == "schema1":
    define_schema1()
elif current_schema == "schema2":
    define_schema2()


You would have to be very careful then to only make the right calls
given the schema otherwise you would end up with an error.

Also be careful with the schema changing - be on the lookout for SQL
injection.


On May 31, 2:47 am, Massimiliano <mbelle...@gmail.com> wrote:
> Sure... That is the way I'm follow...
> Fortunately I haven't tables with the same name...
>
> Ciao
>
>
>
>
>
> On Tue, May 31, 2011 at 3:50 AM, Mathew Grabau <grabau....@gmail.com> wrote:
> > You could always change the schema before executing the db commands:
>
> > db.executesql("set search_path to 'schemaname,public';")
>
> > If you could determine the name of the schema first that would be
> > feasible.
>
> > On May 30, 5:14 am, Massimiliano <mbelle...@gmail.com> wrote:
> > > Hi all,
>
> > > I've a legacy enterprise application that use postgresql as database.
>
> > > Existing tables are divided on different database schemas (not only
> > public).
>
> > > Now I want to rewrite a single application that use existing tables on
> > > schema "xyz".
>
> > > Does web2py support that?
>
> > > Thank you
> > > --
> > > Massimiliano
>
> --
> Massimiliano

Reply via email to