Re: [web2py] Re: DAL() unusable ?

2010-11-12 Thread Branko Vukelic
2010/11/12 Mirek Zvolský : > That's not the case of > http://zvolsky.alwaysdata.net/crm2.jpg DISCLAIMER: I'm not experienced with large-scale database designs. Now that I've gotten that out of the way... What's the meaning of 'created_by' in this set-up? If it's meant to be taken as 'record crea

Re: [web2py] Re: DAL() unusable ?

2010-11-12 Thread Mariano Reingart
2010/11/12 Mirek Zvolský : >>> Mariano Reingart > > Thanks for your response and practical experience with large system. > > I think the problem is clear: > In current web2py philosophy the same data model becames valid or > invalid based on the order of table definition commands. And if a > model

[web2py] Re: DAL() unusable ?

2010-11-12 Thread Mirek Zvolský
> Is there a reason for not sticking the record creation inside of its own > table? Hi Tadeus, This is just an example. I have used it to show Massimo and others, that the simplest part of CRM application model, if you change "created_by" from type "string" to type "reference..", then there is no

Re: [web2py] Re: DAL() unusable ?

2010-11-12 Thread Thadeus Burgess
Right. I get it now. Is there a reason for not sticking the record creation inside of its own table? -- Thadeus 2010/11/12 Mirek Zvolský > hich person is an employee of which company, > 2) which person has created the company record, > 3) which person has created the person records, > all 3

[web2py] Re: DAL() unusable ?

2010-11-12 Thread Mirek Zvolský
>> Mariano Reingart Thanks for your response and practical experience with large system. I think the problem is clear: In current web2py philosophy the same data model becames valid or invalid based on the order of table definition commands. And if a model is complex, then there is no possibility

[web2py] Re: DAL() unusable ?

2010-11-12 Thread Mirek Zvolský
>> Thadeus Burgess >> WRong. cr2 is a really really bad design. >> Database 101, any many to many relationship must be defined through a link >> table. I'm sorry, but you missunderstand the term "many to many relationship" and the term "relation" at all. Because, of course, "one relation" means e

Re: [web2py] Re: DAL() unusable ?

2010-11-11 Thread Mariano Reingart
2010/11/11 Mirek Zvolský : > Oh no!,no!,no! please no! > I still hope it's my mistake only. I simple cannot believe, that this > is behaviour of web2py data model. Are we in year 1960? > Friends, take a look to the oldest database implementations older as > SQL language, in MS-DOS times, f.e. dBase

[web2py] Re: DAL() unusable ?

2010-11-11 Thread mdipierro
True. On Nov 11, 1:23 pm, Thadeus Burgess wrote: > I still do not agree. > > If you run into this issue you can always offset the created_by fields... > > db.define_table('audit_table', > > Field('tablename'), Field('record_id', 'integer'), > > Field('created_by', db.auth_user), > > ) > > If you

Re: [web2py] Re: DAL() unusable ?

2010-11-11 Thread Thadeus Burgess
I still do not agree. If you run into this issue you can always offset the created_by fields... db.define_table('audit_table', Field('tablename'), Field('record_id', 'integer'), Field('created_by', db.auth_user), ) If you ever did need to audit, just look it up in this table. Then you don't h

[web2py] Re: DAL() unusable ?

2010-11-11 Thread mdipierro
I agree with you that using a link table is better. This was my original argument. Yet often the need to sign tables (created_by) will suddenly cause a duplication of tables because lots of link tables have to be added and queries changed. This is what I meant by good case. Massimo On Nov 11, 12

Re: [web2py] Re: DAL() unusable ?

2010-11-11 Thread Thadeus Burgess
WRong. cr2 is a really really bad design. Database 101, any many to many relationship must be defined through a link table. Redesign CR2 like so... db.define_table('person', created_by('person')) db.define_table('company',...created_by('company')) db.define_table('person_company', id_perso

[web2py] Re: DAL() unusable ?

2010-11-11 Thread mdipierro
Ok. Your crm2jpg makes a good case. You proved me wrong. I will try add this by the week-end. Massimo On Nov 11, 11:24 am, Mirek Zvolský wrote: > -> mdipierro > I have prepared 2 pictures, and in this time there is new post from > you about company/author. Interesting that my pictures are about

[web2py] Re: DAL() unusable ?

2010-11-11 Thread Mirek Zvolský
-> mdipierro I have prepared 2 pictures, and in this time there is new post from you about company/author. Interesting that my pictures are about the same :-) Model of your CRM application application is here: http://zvolsky.alwaysdata.net/crm1.jpg Such model can be implemented in web2py, but orde

[web2py] Re: DAL() unusable ?

2010-11-11 Thread DenesL
Wasn't this a no-no?. I got wrist slapped once for suggesting it. :) On Nov 11, 11:53 am, mdipierro wrote: > BTW. This is possible: > > db.define_table('company', > Field('name'), > Field('created_by', 'integer')) > db.define_table('person', > Field('last_name'), > Field('compan

[web2py] Re: DAL() unusable ?

2010-11-11 Thread mdipierro
BTW. This is possible: db.define_table('company', Field('name'), Field('created_by', 'integer')) db.define_table('person', Field('last_name'), Field('company_id', 'reference company')) db.company.created_by.requires=IS_IN_DB(db,'person.id','% (last_name)s') although my object sta

[web2py] Re: DAL() unusable ?

2010-11-11 Thread DenesL
I was thinking of scripted table creation and keeping things simple but I understand what you are saying (or reiterating since it has been said before). If no valid case is made then I could change the manual to explain why it is not supported. Pros/Cons? Denes. On Nov 11, 11:18 am, mdipierro

[web2py] Re: DAL() unusable ?

2010-11-11 Thread mdipierro
>From a syntactical point of view it would not take much to support multi-table circular references in web2py. That is not why they are not implemented, They are not implemented because they are bad design practice. If this is a 1-1 relation, there is no need to table A to refer to B and B to A. I

[web2py] Re: DAL() unusable ?

2010-11-11 Thread David Marko
Yes its the point. When you simply switch the definition order to person table first, web2py will raise the same error with company table doesnt exist yet. David On 11 lis, 17:05, DenesL wrote: > Some of you have missed Mirek's point, and he has a very valid one. > The problem is circular refere

[web2py] Re: DAL() unusable ?

2010-11-11 Thread DenesL
Some of you have missed Mirek's point, and he has a very valid one. The problem is circular references. There are ways around it but no elegant solution yet. There was discussion some time ago about lazy evaluation of tables. I also would like to see this solved in web2py. Denes. On Nov 11, 1

Re: [web2py] Re: DAL() unusable ?

2010-11-11 Thread Thadeus Burgess
Your error seems to be coming from the fact you do not have defined a person model. Since web2py is a functional designed you must define person table before you can reference it. I use the following self-referential table and have never had a problem. db.define_table('participant', #... lots of

[web2py] Re: DAL() unusable ?

2010-11-11 Thread Mirek Zvolský
>> Here's a link to the section in the book: >> http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases Yes, I know this, and from that reason I always use 'reference..' style syntax. However this is about very special foreign keys, which targets to same table (to the primary key

[web2py] Re: DAL() unusable ?

2010-11-11 Thread Mirek Zvolský
Oh no!,no!,no! please no! I still hope it's my mistake only. I simple cannot believe, that this is behaviour of web2py data model. Are we in year 1960? Friends, take a look to the oldest database implementations older as SQL language, in MS-DOS times, f.e. dBase III, FoxBase, Clipper. And earlier o

[web2py] Re: DAL() unusable ?

2010-11-11 Thread villas
Here's a link to the section in the book: http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases On Nov 11, 8:44 am, Mirek Zvolský wrote: > I have simplest model: > > db.define_table('company', >     Field('name'), >     Field('created_by', 'reference person')) > db.define_tabl

[web2py] Re: DAL() unusable ?

2010-11-11 Thread ron_m
Cross reference between tables, see this post http://groups.google.com/group/web2py/browse_thread/thread/b3cb1ce223649e0f/14688d53b3d88857?lnk=gst&q=table+cross+reference#14688d53b3d88857 On Nov 11, 12:44 am, Mirek Zvolský wrote: > I have simplest model: > > db.define_table('company', >     Fie