Vineet,

Agreed, the temp file should be in the DAL.
I don't see at this stage why it would be break the logic.

On May 17, 5:47 am, Vineet <vineet.deod...@gmail.com> wrote:
> Simon,
> I thought on the idea of adding a MySQL temp table to manage insert/
> del/update on multiple tables.
> But there would be a large no. of such forms requiring this
> functionality.
> It is better to avoid fiddling with the schema (which is the database-
> tier) for the sake of business-logic tier.
>
> What if I add a temporary table in DAL itself (along with the other
> linked tables)?
> Would it break the web2py logic of generating, validating, and saving
> the form (if this table is used for generating the form)?
> I mean, if a form is generated from such a temp DAL table, whether it
> is possible to save data in multiple different tables.
>
> ---Vineet
> ============================================
>
> On May 16, 4:33 pm, Simon Ashley <gregs...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Memory tables referred to have no ability to write to disk. Generally
> > we've used these for report accumulations. You could use a MySQL table
> > and delete the record at the end (if need be). Crude and there should
> > be a more pythonic method, but should work.
>
> > Define temp table fields as per the following:
>
> > 1. rec id
> > 2. table1.uid
> > 3. table1.variable
> > 4. table2.uid
> > 5. table2.variable
> > 6. table3.uid
> > 7. table3.variable
>
> > Populate the fields before the load. The uids will of course be hidden
> > on the form but used after the submit in separate database actions.
>
> > Zero uid's would trigger inserts, > 0 for deletions where variables
> > are blank or zero, edits where not. There is a level of programming
> > involved; Massimo implied that.
>
> > In your case, I would be reluctant to denormalise as further
> > complexity could be cumbersome.
> > (if not unworkable. Can think of examples in an application that we
> > are looking at converting that would make anyone's mind spin).
>
> > YMMV
>
> > On May 16, 1:15 am, Vineet <vineet.deod...@gmail.com> wrote:
>
> > > Simon,
> > > That is a good idea.
> > > In fact, almost the same approach is being followed in VFP cursor
> > > adaptor (the difference being that, data from MySQL tables is
> > > reproduced in same table structures, i.e cursors).
>
> > > Here, by virtual table, do you mean to say that we should reproduce
> > > the data into dictionaries by fetching a dict cursor from MySQLdb?
> > > (in DABO, they have an excellent concept of bizobj for this task).
>
> > > I am not asking for exact code, but can you suggest an approach to
> > > tackle the task?
>
> > > Dear Massimo & other friends,
> > > can you pl. suggest something to solve my problem?
>
> > > Thanks,
> > > Vineet.
>
> > > =================================================================
> > > On May 15, 5:07 pm, Simon Ashley <gregs...@gmail.com> wrote:
>
> > > > Since no one has replied for a couple of days, I'll toss my 2 cents
> > > > in. Don't how much value this could be, as we just evaluating web2py
> > > > and python but in another environment we could have written data in
> > > > the normalised records to a temporary record in a denormalised,
> > > > virtualtable, update and saved this record, and then do selective
> > > > updates, insertions and deletions on each normalised record in the
> > > > original tables. Not that elegant but ...
>
> > > > On May 13, 9:17 pm, Vineet <vineet.deod...@gmail.com> wrote:
>
> > > > > pbreit,
> > > > > As you say, wherever possible or required, I have already denormalized
> > > > > thetable-structures.
> > > > > Apart from normalization / denormalization issue, in many other forms,
> > > > > I need to insert/update/delete records inmultipletables from one
> > > > > form.
> > > > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > > > of record(s) in different tables.)
>
> > > > > Massimo,
> > > > > If you too haven't understood what I intend to do with these 5 tables,
> > > > > I can elaborate the idea.
> > > > > Pl. tell me accordingly.
> > > > > The very success of developing my project using web2py hinges on this
> > > > > functionality.
>
> > > > > ---Vineet
> > > > > ================================================
>
> > > > > On May 11, 5:17 am, pbreit <pbreitenb...@gmail.com> wrote:
>
> > > > > > Normalizing is not always the best approach. If the database has 
> > > > > > not yet
> > > > > > been designed, perhaps reconsider. I still don't really understand 
> > > > > > what you
> > > > > > are trying to do but 5 small tables might not be necessary.
>
> > > > > > I would suggest getting some code working with 2 tables an then go 
> > > > > > from
> > > > > > there.
>
> > > > > > Some 
> > > > > > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > > > > > Another approach would to use FORM or SQLFORM.factory and then 
> > > > > > coding the
> > > > > > database updates. You lose some of the Web2py features but it might 
> > > > > > still be
> > > > > > the easiest way to do it.
>
> > > > > > But my first suggestion would be to try and simplify what you are 
> > > > > > intending
> > > > > > to do.

Reply via email to