[Zope-dev] Re: straighting out the SQLAlchemy integration mess

Brian Sutherland brian at vanguardistas.net
Thu Apr 10 15:29:43 EDT 2008


On Thu, Apr 10, 2008 at 07:31:54PM +0200, Andreas Jung wrote:
>
>
> --On 10. April 2008 19:10:49 +0200 Brian Sutherland 
> <brian at vanguardistas.net> wrote:
>
>
>>
>> Just adding my few requirements:
>>     - Integration into the component architecture in such a way that I
>>       can specify the db connection parameters in ZCML and that database
>>       reflection still works. I want to be able to get a handle on
>> SQLAlchemy       things by calling getUtility.
>
> Please *NO* database specific configurations within ZCML. We're running 
> applications in up three or four different environments and I don't want to 
> maintain instance specific configurations within ZCML. Either we pass
> such informations through environment variables or the database connections 
> parameters are read from a configuration within the instance configuration.

What defines if something is the instance configuration?

Isn't ZCML just another format of configuration file? I agree it's evil
to hardcode database connections in the application as they must be
under the control of the sysadmin. But that doesn't preclude them from
being expressed in zcml.

I *do* like the idea of using one and only one file format to configure
applications.

We also run the in a few different environments, the
/etc/myserver/site.zcml is different on a per instance basis and looks
like this:

<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:rdb="http://namespaces.zope.org/rdb">

  <include package="mymodule" file="configure.zcml" />

  <rdb:provideConnection
      name="admin"
      component="psycopg2da.adapter.Psycopg2Adapter"
      dsn="dbi://prototype" />

</configure>

But, I'm diverging, my point is that it would be nice to be able to have
SQLAlchemy connections available as IZopeDatabaseAdapter utilities to
allow a migration path.  Whether they are defined in or out of ZCML, I
just don't care.

-- 
Brian Sutherland


More information about the Zope-Dev mailing list