Does Jeff's SQLAlchemy support currently work?

1 view
Skip to first unread message

Karl Guertin

unread,
Apr 14, 2006, 11:34:26 AM4/14/06
to turbo...@googlegroups.com
I've been out of the loop for a month, but I was wondering if Jeff's
example code[1] works with the current TG1.0 branch and the sqlalchemy
trunk.

[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?

Patrick Lewis

unread,
Apr 14, 2006, 12:24:40 PM4/14/06
to TurboGears
I don't know about the trunk of SqlAlchemy, but it is working just fine
for me with turbogears 1.0 branch and sqlalchemy 0.1.6. The only place
I had trouble with was figuring out that my dev.cfg needed the line:

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.

Jonathan LaCour

unread,
Apr 14, 2006, 12:26:57 PM4/14/06
to turbo...@googlegroups.com
On Apr 14, 2006, at 11:34 AM, Karl Guertin wrote:
> I've been out of the loop for a month, but I was wondering if Jeff's
> example code[1] works with the current TG1.0 branch and the sqlalchemy
> trunk.

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


Reply all
Reply to author
Forward
0 new messages