On 8/12/07, Jason R. Coombs <[EMAIL PROTECTED]> wrote:

> Here's the problem.  I have a legacy database I'm trying to manage
> with SQLAlchemy/Elixir.
>
> Formerly, I was using just Elixir, and I had written a metaclass
> similar to elixir.EntityMeta to wrap common functionality in my
> Entities.
>
> Now that Elixir has come along, I'm porting my classes to it, but
> there are two things that I had done that I'm struggling with in
> Elixir.  I'm hoping there's an easy way to do what I want already in
> Elixir.  If not, I'd like to propose this type of functionality be
> added.

I think you should be able to solve both problems with either custom
statements (which were recently improved to provide predefined hook
points) or a custom MetaClass (inheriting from EntityMeta).

To define a custom statement triggering a method at a specific
initialization point, you can defined a statement-handling class with
methods with specific names (the method name is the hook point). For
example, if you want to do something after the table is setup, you
should provide an "after_table" method to your statement-handling
class. In that method, you should be able to alter the table/sequence
as you want.

Look in http://elixir.ematia.de/svn/elixir/trunk/elixir/ext/versioned.py
for an example.

Please report back any success as this would prove a good recipe.

Hope this helps,
-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to