youre probably looking for:
self.mysession.query(Spectrometers).select(...)
On Aug 29, 2006, at 9:46 AM, Enrico Morelli wrote:
> Dear all,
>
> I'm writing a program using CherryPy and SQLAlchemy that works fine if
> I don't use the SA session. When I start to use sessions I have the
> following error:
>
> Traceback (most recent call last):
> File "webnmr_sqlalchemy_psql.py", line 2392, in ?
> cherrypy.root.HttpProtected = HttpProtected()
> File "webnmr_sqlalchemy_psql.py", line 180, in __init__
> self.instruments=self.mysession(Spectrometers).select
> (spectrometer.c.tipology=='S',
> order_by=['name'])
> TypeError: 'Session' object is not callable
>
> These are some few lines from the program.
>
> import cherrypy
> from sqlalchemy import *
>
> class HttpProtected:
>
> def __init__(self):
>
>
> engine=create_engine('postgres://[EMAIL PROTECTED]:5432/NMR2')
>
> metadata = BoundMetaData(engine)
>
> projects=Table('projects',metadata, autoload=True)
>
> class Projects(object):
> pass
> projectmapper = mapper(Projects, projects)
> self.mysession = create_session()
> self.instruments=self.mysession(Spectrometers).select
> (spectrometer.c.tipology=='S',
> order_by=['name'])
>
>
> Is it possible that the session managed by cherrypy conflicts with the
> session used by SA? There is a solution?
>
> Thanks
> --
> -------------------------------------------------------------------
> (o_
> (o_ //\ Coltivate Linux che tanto Windows si pianta da solo.
> (/)_ V_/_
> +------------------------------------------------------------------+
> | ENRICO MORELLI | email: [EMAIL PROTECTED] |
> | * * * * | phone: +39 055 4574269 |
> | University of Florence | fax : +39 055 4574253 |
> | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
> +------------------------------------------------------------------+
>
> ----------------------------------------------------------------------
> ---
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users