Re: [sqlalchemy] Re: Retrieving Objects from DB

2016-12-16 Thread 'Simon Dold' via sqlalchemy
Nice,I feel really stupid now but thank you very much, will verify this later. Best, Simon.. Am 16.12.2016 6:42 nachm. schrieb "Jonathan Vanasco" : > > > On Friday, December 16, 2016 at 12:14:11 PM UTC-5, Simon Moon wrote: >> >> >> It seems m is not a Machine object. I think it should be clear wh

[sqlalchemy] Re: Retrieving Objects from DB

2016-12-16 Thread Jonathan Vanasco
On Friday, December 16, 2016 at 12:14:11 PM UTC-5, Simon Moon wrote: > > > It seems m is not a Machine object. I think it should be clear what I want > to do, but I can't figure what the > SQLAlchemy way would be to do it > replace this: m = session.query(Machine.name).filter(... wit

Re: [sqlalchemy] does anyone know how to debug the orm creating joinedload objects?

2016-12-16 Thread Jonathan Vanasco
On Friday, December 16, 2016 at 12:01:04 PM UTC-5, Mike Bayer wrote: > > You need to be inside orm/strategies.py in JoinedEagerLoader where it > deals with row_processor. The "path" variable will show which relationship > it thinks it's loading. > >> >> PERFECT! thanks. -- SQLAlchemy - Th

[sqlalchemy] Re: Retrieving Objects from DB

2016-12-16 Thread 'Simon Moon' via sqlalchemy
class Machine(Base): __tablename__='machine' id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) comment= Column(String(250)) tags = Column(String(250), nullable=True) class GeneralMeasurementData(Base): __tab

[sqlalchemy] Retrieving Objects from DB

2016-12-16 Thread 'Simon Moon' via sqlalchemy
Dear All, I want to do something like this: (MachineExists,), = session.query(exists().where(Machine.name.like('%'+machine+'%'))) if not MachineExists: print("Specify machine name better") return m = session.query(Machine.name).filter(Machi

Re: [sqlalchemy] does anyone know how to debug the orm creating joinedload objects?

2016-12-16 Thread Mike Bayer
You need to be inside orm/strategies.py in JoinedEagerLoader where it deals with row_processor. The "path" variable will show which relationship it thinks it's loading. On Dec 16, 2016 11:27 AM, "Jonathan Vanasco" wrote: > > > On Friday, December 16, 2016 at 9:14:21 AM UTC-5, Mike Bayer wrote:

Re: [sqlalchemy] does anyone know how to debug the orm creating joinedload objects?

2016-12-16 Thread Jonathan Vanasco
On Friday, December 16, 2016 at 9:14:21 AM UTC-5, Mike Bayer wrote: > > Those aren't easy cases to debug. Isolating the behavior into a small > test is the best first step, failing that you'd at least have echo set to > debug , and you can watch the rows cone in. If it were me I'd then be >

Re: [sqlalchemy] does anyone know how to debug the orm creating joinedload objects?

2016-12-16 Thread Mike Bayer
Those aren't easy cases to debug. Isolating the behavior into a small test is the best first step, failing that you'd at least have echo set to debug , and you can watch the rows cone in. If it were me I'd then be pdb'ing, but I realize that's because I know the eagerload mechanics pretty well.