In SQL, a table can only have one primary key. Web2py insists that the primary key of every table is 'id' and 'id' alone. So without a fundamental change-of-mind I don't see how a complex primary key can be supported in web2py.
That said, SQL supports multiple UNIQUE keys, both single and multi column. The PRIMARY key is just a special case of UNIQUE. I believe that web2py already supports single column unique constraints. It is multi-column unique constraints that I want to add to the DAL (although they can already be created by native SQL and executesql()). Requires/validators work as form validation rather than database configuration but I suppose there is is nothing to stop IS_NOT_IN_DB statements being used to create db constraints in addition to specifying a validator. On Dec 16, 2:59 pm, Timothy Farrell <tfarr...@swgen.com> wrote: > In the thread on validating multiple fields, I was trying to use validators > to get around the problem of lack of complex primary key support. The better > solution is to have true complex primary key support rather than a validator > that scaffolds this restriction only when using SQLHTML helpers. > My design philosophy difference with Massimo that I mentioned is that > validators should be used in the DAL for updating and inserting rather than > creating the impression of a true restriction that only really exists if you > use the SQLHTML helpers. > For a DAL to be a true DAL, it needs to support a reasonable subset of the > databases it abstracts. That's what Bill and I are proposing here (Bill stop > me if I'm putting words in your mouth). Complex primary keys and the > multi-field uniqueness restriction go hand-in-hand. They are very nearly the > same thing but more importantly they pave the way for restrictions to be > handled by the DAL and not (necessarily only) the SQLHTML helpers. > Is that more clear? > -tim > DenesL wrote:Tim, wasn't this resolved in a recent thread?. Is your > definition of "Complex Primary keys" different from that?. Just trying to > understand... On Dec 16, 9:19 am, Timothy > Farrell<tfarr...@swgen.com>wrote:Bill, I'm with you. Complex Primary keys is > tops on my wishlist right now. Part of the reason I wanted a web2py wiki so > much is so we could do stuff like this in PEP style. For those unfamiliar > with PEPs:http://www.python.org/dev/peps/pep-0001/I'm over at the wiki, > starting a WEP section. -tim-- Timothy Farrell<tfarr...@swgen.com>Computer > Guy Statewide General Insurance Agency (www.swgen.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---