Hi All, I have something stuping me right now. I'm using SqlAlchemy .
0.5.2 and Python 2.6. My issue is as follows:
This class works perfectly:
import sys
import pprint
import pdb
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
sys.path.append('../config')
import config
from MemberProfiles import *
from Gender import *
class MemberInfo:
def __init__(self):
engine = create_engine(config.db_conn)
Session = sessionmaker(bind=engine)
self.session = Session()
Base = declarative_base()
metdata = Base.metadata
def GET(self,memberid):
memberInfo = self.session.query(MemberProfile,Gender).filter
(MemberProfile.memberID==memberid).first()
print memberInfo[0].__dict__,memberInfo[1].__dict__
return memberInfo[0]
if __name__ == "__main__":
x=MemberInfo()
x.GET(81017)
This class creates in instance of the above class, and the invocation
of the above class returns an empty result:
import sys
import cherrypy
import routes
import pdb
sys.path.append('../models')
import MemberInfo
class Dispatch:
def __init__(self):
self.methods = ('OPTIONS','GET','HEAD','POST',
'PUT','DELETE','TRACE','CONNECT')
self.mp = MemberInfo.MemberInfo()
def test(self):
#http_method = getattr(self,"self.mp.%s" %
cherrypy.request.method)
result=self.mp.GET(18087)
return result.memberID
if __name__ == "__main__":
x=Dispatch()
print x.test()
They're both using the same confi file to open the same database. I am
really boggled about this. What am I missing?
Thank you in advance,
Gloria
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---