[DB-SIG] db-api suggestions / zike data classes
Tue, 18 Apr 2000 09:25:26 -0500
On 17 Apr 2000, at 19:01, Andy Dustman wrote:
> On Fri, 14 Apr 2000, Michal Wallace (sabren) wrote:
> > I'm attempting to build an abstraction layer on top of the DB-API,
> > that gives an object-oriented interface to individual records. Here's an
> > example:
> Also take a look at:
> for SQLDict (it doesn't have it's own page). It has an ObjectBuilder
> class, which uses table and column specifications to determine what
> attributes the object has, and when these objects are registered with a
> SQLDict object, it generates the necessary SQL to SELECT, UPDATE, and
> DELETE the objects directly. As an example (not guaranteed to work):
I've been using SQLDict for a week and I say, it is a really nice peice of
I'm using it with Zope.
My problem was seperating "business logic" from presentation. I wanted
an object oriented interface to records, and a mechanism to
conveniently use those objects via the Web.
SQLDict has given me the former method. I'm working on my own
HTMLForm tools that works in conjunction with SQLDict based objects
to create basic forms and to represent one-to-one, many-to-one, many-
I'd like to take a look at Andy's HyperText, but starship has been down
for a while now.
Some mods I've made to SQLDict:
1. Added __getitem__ support to SQLDict, and Table items to make
lookup easier from Zope.
2. There is a circular reference problem when using the register()
method of ObjectBuilder. Tables point to SQLDict, and SQLDict points
to table, and Index points to Table and Table points to Index. I've added
a _delete() method to SQLDict, Table and Index to help break these
Its an ugly hack, I'm not sure how to do it nicer.
3. Added onValidate(), onUpdate(), onCreate() dummy methods to
ObjectBuilder. I think onValidate() should go in my other Mix-in class, I'll
probably move it out of ObjectBuilder.
4. Added an update(), refresh() and delete() method to ObjectBuilder
5. set_keywords() can take an instance object.
Brad Clements, email@example.com (315)268-1000
http://www.murkworks.com (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com AOL-IM: BKClements