Re: [sqlalchemy] to many statements for collection.append?

2011-11-10 Thread Michael Bayer
On Nov 9, 2011, at 3:37 AM, sector119 wrote: > > ### TEST 2 > # HERE I GOT ERROR if I uncomment "user = ..." line > > session = Session() > > report = session.query(Report).get(1) > #user = session.query(User).filter_by(username='sector119').one() > comment = Comment(content=u'test comment', u

Re: [sqlalchemy] to many statements for collection.append?

2011-11-09 Thread sector119
### TEST 1 STATEMENTS 2011-11-09 13:30:24 EET LOG: statement: BEGIN 2011-11-09 13:30:24 EET LOG: statement: SELECT report.id AS report_id, report.content AS report_content, report.comments_count AS report_comments_count, report.user_id AS report_user_id FROM report WHERE report

Re: [sqlalchemy] to many statements for collection.append?

2011-11-08 Thread Michael Bayer
On Nov 8, 2011, at 1:47 PM, sector119 wrote: > Hi. > > Why SA produce last UPDATE if I set report_id value? > And why it produces those two SELECTs if I do not perform read access to > report and report.comments? > Should not it exec only one insert? again, no idea. the get() will emit a SELE

[sqlalchemy] to many statements for collection.append?

2011-11-08 Thread sector119
Hi. Why SA produce last UPDATE if I set report_id value? And why it produces those two SELECTs if I do not perform read access to report and report.comments? Should not it exec only one insert? report = session.query(TripReport).get(id) comment = TripReportComment(content=form.content.data, user