[Grok-dev] Grok with existing SQLAlchemy mapped classes
Santiago Videla
santiago.videla at gmail.com
Thu Jul 23 17:03:41 EDT 2009
Hey,
On Thu, Jul 23, 2009 at 3:40 PM, Wyatt Baldwin
<wyatt.lee.baldwin at gmail.com>wrote:
> I have an existing Web application written in Python that I'm looking to
> re-implement in a modern Python framework. Now that Grok is approaching 1.0,
> I am taking another look at it for this purpose, and it's lookin' good.
>
> My only question (at this point, anyway) is whether there is a way to reuse
> existing SQLAlchemy-based model classes without having to add any Grok
> directives and/or Zope-specific integration code to them. The model for my
> application is in a "core" package that *cannot* be modified to support Grok
> (or any other Web framework) directly. One idea I have is a function that
> takes a SA mapped class and returns a Grok model.
>
> I've started looking at some of the libraries for integrating SA with
> Zope/Grok, but I admit that I haven't looked very deeply as yet. I've also
> been reading the Grok docs and this list but haven't found a definite answer
> yet. Is what I want to do already possible? Would it be straightforward to
> implement something like an `sa_model_wrapper`? Can I create a subclass of a
> SA model class that uses `grok.Model` as a mixin?
You may want to checkout megrok.rdb [1] but I'm not sure if it's what you
are looking for.
Take a look to the doctest of reflection [2], I didn't try it my self, but
it seems that you are able to define Grok models that will be mapped to
existing tables.
Best Regards
[1] http://svn.zope.org/megrok.rdb/
[2] http://svn.zope.org/megrok.rdb/trunk/src/megrok/rdb/tests/reflection.py
>
>
> Any pointers or suggestions would be appreciated, and if RTFM if part of
> the answer, please give a page number. ;)
>
>
> [Note: I originally sent this message through the Google Groups UI a few
> days ago and nothing happened. Now I've subscribed through the mailman UI
> and am sending this directly to the list address.]
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
--
Santiago Videla
www.revolucionesweb.com.ar
http://www.linkedin.com/in/svidela
Sigue la mata dando de que hablar siempre abajo y a la izquierda donde el
pensamiento que se hace corazón resplandece con la palabra sencilla y
humilde que l at s tod at s somos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090723/d23fe446/attachment.html
More information about the Grok-dev
mailing list