I should add that you *can* be more creative, and construct each mapper
with a MapperExtension at the beginning which later can be "enabled" with
a "hello world" callable.  i.e.


class MyExt(MapperExtension):
    def __init__(self):
        self.func = None
    def after_insert(self, ...):
        if self.func:
             self.func()

extension = MyExt()
mapper(foo, bar, extension=extension)
mapper(foo2, bar2, extension=extension)
mapper(foo3, bar3, extension=extension)

... do stuff ...

def helloworld():
    print "hello world"
extension.func = helloworld

... do stuff ...





percious wrote:
>
> question.
>
> Lets say I have a series of table definitions, and a series of objects
> linked to the tables with a bunch of mappers.
>
> First question:  Is there a way to get from the table definitions in
> the metadata to the Mapper?
>
> Second question:  If I create a MapperExtension, can I then link it to
> the mapper associated with a table?
>
> What I want to do is create a simple application that goes through the
> tables defined within a metadata, and create an extension so that
> every time a table entry is added it prints 'hello world' to the
> screen.
>
> TIA
> -chris
>
>
> >
>


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

Reply via email to