as you would expect if they were defined in the table

db.define_table('standardt', SQLField('myfield'))
db.define_table('history', db.standardt, SQLField
('metadata','string'))

db.history.insert(myfield='myvalue',metadata='myothervalue')

Massimo


On May 13, 11:05 pm, JohnMc <[email protected]> wrote:
> Whoa! I have not seen that construct before.
>
> So how does one address the 'inner' fields of standardt from history?
>
> On May 13, 1:45 pm, mdipierro <[email protected]> wrote:
>
> > That works but it is much easier than that since web2py supports it:
>
> > db.define_table('standardt', .... standard fields ... )
> > db.define_table('history', db.standardt, SQLField
> > ('metadata','string'))
>
> > Notice can a field can be another table (i.e. all fields of the other
> > table). You can extend more than one table and you can have the fields
> > in any order you like.
>
> > On May 13, 1:31 pm, Jurgis Pralgauskis <[email protected]>
> > wrote:
>
> > > Hello,
>
> > > I want to achieve sth similar tohttp://sqlobject.org/Inheritance.html
> > > but probably simpler:
>
> > > my pattern in few apps is:
> > > I have some table, with info which can change freequently
> > > I want to have full history of it + some metadata:
>
> > > so I want 2 tables:
> > > 1) standart
> > > 2) history = standardt+[user_who_changed, date_of_change, action_CUD]
>
> > > is my approach correct?
>
> > > standardt_fields = [   SQLField('info','text'),  ] # many feelds in
> > > reality
> > > db.define_table('standardt', *standardt_fields     )
>
> > > fields2 = standardt_fields+[ SQLField('metadata','string'),  ]
> > > # would be more aditional fields in reality
> > > db.define_table('history', *fields2    )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to