Here is the final version.

On Mon, Sep 21, 2009 at 8:45 AM, Lukasz Szybalski <[email protected]> wrote:
>> Before init_model:
>> from sqlalchemy import Table
>> from sqlalchemy.orm import mapper, relation
>>
>> class Recall(object):
>>     def __init__(self, **kw):
>>        """automatically mapping attributes"""
>>        for key, value in kw.iteritems():
>>            setattr(self, key, value)


>> Inside the init_model do:

>>    recall_table = Table('recall_db', metadata,
>> autoload=True,autoload_with=engine)
>>
>>    #Mapping of Table to Python Object Class
>>    mapper(Recall, recall_table,primary_key=[recall_table.c.RECORD_ID])
>>

The python class need to be outside of the init model function. It
could probably be imported as well.

Now your model should show in admin interface. If you are using rum
then you can even download a csv of the data. Not sure if catwalk has
that.


Now I just have to try sqlsoup to see if I can preload 100+ tables
without typing mappers, and table autoloads.

Thanks,
Lucas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to