[Grok-dev] Re: megrok.rdb updated
support at oeko.net
Wed Jul 9 19:32:57 EDT 2008
On Wed, 09.07.2008 at 22:22:15 +0200, Martijn Faassen <faassen at startifact.com> wrote:
> Toni Mueller wrote:
> > ...
> megrok.rdb uses the SQLALchemy declarative extension. The idea of this
> is that you can design your model classes at the same time as the
> tables, in the same class, describing fields.
once I'm going to make use of interfaces, I have to define a schema two
times anyway, right? Then writing it once as a zope.schema that helps
with UI creation and once as an SA schema, that helps with declaring
referential integrity (which is impossible to do with, and outside the
scope of, zope.schema), imho doesn't really add much of a burden. I
therefore use eg.
field1 = zope.schema.TextLine(...)
__tablename__ = 'abctable'
field1 = ...
form_fields = grok.AutoFields(interfaces.IAbc).omit('id')
> SQLAlchemy also supports another case where you define your tables and
> object-relational mappers in a less integrated way. It's more gluing up
I discovered SQLAlchemy before I discovered Grok...
> I'd like to hear more about what you think could be done to help making
> the separate schema + SA column story end-user ready.
Well, currently my quite limited understanding prevents me from doing
the right thing, but I think that it's not so much a question of
knowing Grok, but much more a question to make my way through
zope.schema, zope.formlib and/or z3c.form. Using more advanced field
types and widgets (files, esp. images, select boxes etc), and how to
tack validation onto all of it, is currently far from obvious to me.
I guess I'll have to take another intense look at kirbi & friends...
More information about the Grok-dev