I'm working with TurboGears which defines a session like so:
def create_session():
"Creates a session with the appropriate engine"
return sqlalchemy.create_session(bind_to=get_engine())
session = activemapper.Objectstore(create_session)
This code:
# tg_session is session from above.
trans = tg_session.create_transaction()
projects = class_mapper(Project).mapped_table
s = select([func.max(projects.c.id)])
print s.engine
result = s.execute()
produces this output:
<module 'sqlalchemy.engine' from
'/home/randall/downloads/svn/sqlalchemy_0.2.6/lib/sqlalchemy/engine/__init__.pyc'>
print s.engine should show that s.engine is an engine instance, but
instead it shows it is the engine module.
and here is the traceback:
File
"/home/randall/programs/mswater/svn/tgwater/trunk/tgwater/tgwater/planreview/model.py",
line 15, in getNextProjectID
result = s.execute()
File
"/home/randall/downloads/svn/sqlalchemy_0.2.6/lib/sqlalchemy/sql.py",
line 514, in execute
return self.execute_using(self.engine, *multiparams, **params)
File
"/home/randall/downloads/svn/sqlalchemy_0.2.6/lib/sqlalchemy/sql.py",
line 468, in execute_using
return self.compile(engine=engine,
parameters=compile_params).execute(*multiparams, **params)
File
"/home/randall/downloads/svn/sqlalchemy_0.2.6/lib/sqlalchemy/sql.py",
line 500, in compile
compiler = engine.compiler(self, parameters)
AttributeError: 'module' object has no attribute 'compiler'
Any idea why this is happening? I'm working on a test case that will fail.
Randall
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users