[1] http://nerd.newburyportion.com/2006/02/turbogears-is-now-unstoppable
Using the model.py from his example:
from sqlalchemy import *
from sqlalchemy.ext.activemapper import *
import turbogears
__engine__ = turbogears.database.PackageEngine( "graywiki" )
class Page(ActiveMapper):
''' A page in our Wiki. '''
class mapping:
page_id= column( Integer, primary_key=True )
pagename= column( String(30), unique=True )
data= column( Unicode )
I load it up into tg-admin shell:
In [1]: p = Page(pagename="FrontPage",data="Test")
In [2]: objectstore.commit()
InvalidRequestError: Class 'Page' entity name 'None' has no mapper
associated with it
In [3]: p.mapper
Out[3]: <sqlalchemy.mapping.mapper.Mapper object at 0x40acb90c>
In [4]: objectstore.commit()
InvalidRequestError: Class 'Page' entity name 'None' has no mapper
associated with it
What's my problem?
analyst.sqlalchemy.dburi =
"postgres://database=analyst_dev&host=127.0.0.1&user=postgres"
Where my PackageEngine is "analyst".
Sorry, not terribly helpful, but it is another datapoint.
I believe that the most recent release of SQLAlchemy has changed
quite a bit, causing ActiveMapper to be in a non-working state right
now. I just haven't had the time to sit down and spend the hour or
two needed to integrate patches and make everything work again, since
I have had so many other things going on.
Please, feel free to take a look at the code yourself! I could
really use the help, and would be happy to commit any patches received.
--
Jonathan LaCour
http://cleverdevil.org