Thanks for your help Mark
Here are the steps I followed:
* quickstarted my app
* updated development.ini's sqlalchemy.url to use a mysql database
* added the following code to model.__init__.py
t_clients = Table("clients", metadata, autoload=True,
autoload_with=config['pylons.g'].sa_engine)
class Client(object):
pass
mapper(Client, t_clients)
Nothing more than that (I have just followed these steps again). As I
said before, I made it work in a new pylons-trunk project, but
model.__init__.py works different: it has an init_model(engine)
method, which is called from environment.py (this way, i didn't need
to get the engine via the config).
Thanks again for your help.
On Jan 23, 10:23 am, "Mark Ramm" <[EMAIL PROTECTED]> wrote:
> Could you post some code for us?
>
> We're more than happy to help, but I think we need a bit more information.
>
> --Mark Ramm
>
> On Jan 22, 2008 2:30 PM, Luciano G. Panaro <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi guys,
>
> > I am trying tg2 and I've come across an issue when trying to reflect a
> > table for my model. So I quickstarted my app, and followed the
> > instructions
> > athttp://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+0.4+for+pe...
>
> > However, when the model.__init__.py tries to get
> > config['pylons.g'].sa_engine, it crashes: "AttributeError: 'NoneType'
> > object has no attribute 'sa_engine'"
>
> > So it looks that the config is not loaded when the model is imported.
>
> > I tried doing the reflection with a new Pylons (trunk) app and I was
> > able to do it. However, the code inside environment.py and
> > model.__init__.py is different, and I didn't need to get sa_engine to
> > make it work.
>
> > Am I missing something? Have any of you guys got sqlalchemy's
> > reflection working?
>
> > Thanks in advance :)
>
> --
> Mark Ramm-Christensen
> email: mark at compoundthinking dot com
> blog:www.compoundthinking.com/blog
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---