[Grok-dev] Re: SQLAlchemy integration

Martijn Faassen faassen at startifact.com
Sat May 17 14:52:17 EDT 2008

Hi there,

Santiago Videla wrote:
> I'm going to start a project and really need a Relational Database. I 
> found this post http://faassen.n--tree.net/blog/view/weblog/2008/04/08/0 
> but I didn't try it...yet.
> is there any example app with some CRUD or something like that?? if 
> there isn't, I think that I have some work to do :)

This is currently a story in transition. I'm indeed doing what that blog 
entry said. Christian Klinger has made StormContainer.

At the sprint, Christian Klinger, myself and others discussed how to 
improve SQLAlchemy integration into Grok, including container support, 
etc, and started the work.

The result of that is in http://svn.zope.org/grokapps/rdbexample

This is severely unfinished at present (and might not even work, you 
might need a branch that Philipp made, due to recent changes in Grok). 
We were pretty happy with what we accomplish at the sprint however.

I and others hope to be able to move forward with this in the coming 
months. If you want to help out, that would be very welcome.

Let me describe the current state of rdbexample (and in particular the 
sketch of megrok.rdb that's in there):

* supports rdb.Container, rdb.Model backed by SQLAlchemy

* supports defining tables and relations using SQLAlchemy's declarative 
extension, inline in the model classes

* supports generating a Zope 3 schema from table schema

* we have support in the trunk that allows easy traversal of attributes, 
which helps exposing a database model (grok.traversable directive)

What needs to be done:

* it relies on Grok trunk as it needs features in that

* it's currently likely broken, because of changes in Grok trunk since 
then (Philipp's branch should help)

* it currently uses collective.lead for integration with SQLAlchemy. 
After the sprint zope.sqlalchemy was born, and we want to start using 
this (there's consensus about this bein a common base for SQLAlchemy 
integration in Zope)

* there are lots of missing details: schema generation is just a sketch, 
important items like field order are missing right now, we can't support 
multiple instances of an RDB-using application (with the same schema but 
different databases), besides the container we already have we probably 
also need something like a query-backed containerish thing, etc.

Anyway, despite all these flaws, I'm actually quite excited about what 
we managed to accomplish at the sprint. We need a few energetic hackers 
to push it forward, we need to document it, and then I think Grok will 
have first-class RDB support that can compete head-on with other frameworks.



More information about the Grok-dev mailing list