Hello Norbert,

I forgot in my solution post, you will need a trigger function on update and
deletion of records to make sure that person_company table is always sync
with the person table. It surely not the better solution.

Of course a view is noting esle then a stored SQL select...

Here what I usally do...

CREATE OR REPLACE VIEW myview AS
 SELECT table.id, table.otherfield1
   FROM table
   JOIN if needed (in your case it is needed)
       ON ()
  WHERE ifneeded

ALTER TABLE myview OWNER TO myowner;

Then I define this as a model into web2py...

table.id become the table id.

Then I use this table instead of the regular table to get the field from
other table in your case company...

Richard



On Fri, Mar 11, 2011 at 2:49 AM, Norbert Klamann <
[email protected]> wrote:

> """
> a) I don't think DAL has SQL view... If someone can correct me on this
> affirmation...
> """
> I speculate that the query Object comes close, but I do not knwo how to
> reference it in a validator.
>
>
> """
> c) I Think that your table company is not necessary if there is always only
> one person for one company, but if you have many person in the same company
> you will get a person table nomalised level 1 if you don't have a company
> table.
> """
> I gave only s asimplified extract of my model, A company has a lot of
> properties and relations of its own, so it has to be a table.
>
>

Reply via email to