[DB-SIG] Re: [Python-Dev] database APIs

Kevin Jacobs jacobs@penguin.theopalgroup.com
Mon, 3 Feb 2003 09:48:54 -0500 (EST)


On Mon, 3 Feb 2003, Luke Kenneth Casson Leighton wrote:
>  the more complex requirements that i have are more like a substitute
>  for SQL "VIEWs".  proper views, not just read-only VIEWs like some
>  SQL database have.

Logical read/write views don't really solve your problem either.  The heart
of your situation involves (roughly) these processing steps:

  1) Extract and unencode variables from the CGI enviornment
  2) Decode the variable names and map them to schema elements
  3) Validate the variable values against the schema and business logic
  4) Group variables into transactional batches and sub-batches
     based on the physical schema
  5) Render and execute SQL to perform updates

Most of the above can be done fairly generically in Python, with minimal
code needed for each particular form you are processing.  However, there is
no short-cut magic bullet "save" routine or "View" object that can do all of
the above.  I recommend focusing on implementing concise and powerful
abstractions for each step seperately.
  
>  one of the input forms has now got so complex that the update
>  function is 160 lines of code and the add function is 100.
>  and that's simply turning HTML POST cgi form dictionaries / lists
>  into dictionaries

Then you need to write smarter code!  Post some of that code and some of the
smarties here are sure to have suggestions on how to implement better
abstractions.

In the mean time, I'm working hard to release more of my code as open
source.  It provides many features that would likely help you and others.

Regards,
-Kevin Jacobs

-- 
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com