[DB-SIG] Creating portable Python database code

Christopher Petrilli petrilli@amber.org
Tue, 22 Feb 2000 23:31:28 -0500


Tom Bryan [tbryan@starship.python.net] wrote:
> 
> Another consideration is where you want your flexibility.  It may be wise
> to simply hide the SQL from almost all of your code in some sort of data
> access classes.  Those classes know how and where to find the data (MySQL
> DB, Oracle DB, flat file, somewhere out on the web, etc.), and other
> objects who need to get data just instantiate one or more data access
> objects to get the data.  Especially in light of what Christopher says
> here, you may want to consider an architecture following something like
> the adapter pattern so that you can easily change the "back end" without
> affecting any of your code other than the data access (adapter) class.

This is the architecture that I push with Zope (and also one that Apple
has pushed in Enterprise Objects).  Unfortunately, often people skip the
multi-tier architecture because it's not familiar, or they feel that
their project won't ever change... often a misled idea :-)

I think is important... unfortunately SQLMethods in Zope aren't easily
removed from the rest of the framework, but this is what they provide.

Chris
-- 
| Christopher Petrilli
| petrilli@amber.org