On Tue, Apr 15, 2014 at 12:06 PM, robert <[email protected]> wrote: > Hi there, > > I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a > call > > > I have a a mapped class: > > # tblKey2goGdataLocation > # > ---------------------------------------------------------------------------- > # > class tblKey2goGdataLocation(Base): > __tablename__ = "tblKey2goGdataLocation" > id = Column(Integer, nullable=False, primary_key=True) > location = Column(Geometry('Point')) > name = Column( Text ) > description = Column( Text ) > location_type = Column( Integer ) > > companies = relation( > "tblCompany", > secondary= tblCompanyLocation.__table__, > backref="locations", > ) > > I try to retrieve an maped instance using this query: > > q = session.query(tblKey2goGdataLocation.__table__) > c = tblKey2goGdataLocation.__table__.c > q = q.filter(c['id'] == 123) > result = q.first() > > now result is of type: > type(result) > <class 'sqlalchemy.util._collections.KeyedTuple'> > > why? > > how can I use this element to update the database record? > or, how can I get an updatable instance ? >
I think you want something like this: q = session.query(tblKey2goGdataLocation) q = q.filter(tblKey2goGdataLocation.id == 123) result = q.first() Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
