[sqlalchemy] update a relation from its id

2010-09-02 Thread chaouche yacine
Hello group, Suppose A has a ManyToOne relation to B (A is a child of B). I want to perform something like : a.b_id = b.id assert a.b == b How do I do this in sqlalchemy ? The following attempt failed --- from sqlalchemy import * from sqlalchemy.orm import

RE: [sqlalchemy] update a relation from its id

2010-09-02 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of chaouche yacine Sent: 02 September 2010 11:02 To: sqlalchemy googlegroups Subject: [sqlalchemy] update a relation from its id Hello group, Suppose A has a ManyToOne relation

[sqlalchemy] with_polymorphic() and merging two subclassed Query ?

2010-09-02 Thread Julien Cigar
Hello, Another quick question on .with_polymorhpic() .. :) When I use inheritance I always subclass a Query object per mapped (child) class, for example : class QueryRoot(orm.Query): def available_to_all_children(self): return self.filter(...) class RootModel(object): query =

Re: [sqlalchemy] with_polymorphic() and merging two subclassed Query ?

2010-09-02 Thread Michael Bayer
On Sep 2, 2010, at 8:59 AM, Julien Cigar wrote: Hello, Another quick question on .with_polymorhpic() .. :) When I use inheritance I always subclass a Query object per mapped (child) class, for example : class QueryRoot(orm.Query): def available_to_all_children(self): return

Re: [sqlalchemy] with_polymorphic() and merging two subclassed Query ?

2010-09-02 Thread Julien Cigar
On 09/02/2010 17:55, Michael Bayer wrote: On Sep 2, 2010, at 8:59 AM, Julien Cigar wrote: Hello, Another quick question on .with_polymorhpic() .. :) When I use inheritance I always subclass a Query object per mapped (child) class, for example : class QueryRoot(orm.Query): def

[sqlalchemy] Re: CircularDependencyError on 0.6 (works on 0.5.8)

2010-09-02 Thread sandro dentella
On 26 Ago, 18:41, Michael Bayer mike...@zzzcomputing.com wrote: of course you'll get a cycle if you do this, though: s1 = School(cod=S1, cod_riferimento=S1, cliente=False) d1 = School(cod=D1, cod_riferimento=S1, cliente=False) s1.sedi = [s1, d1] That was it! now I got it. thanks. s1-s1

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, User_job_progress.job_id==Job.job_id)).filter(User_job_progress.fb_uid==1) results in a query of: FROM xxx_jobs LEFT OUTER JOIN xxx_user_job_progress ON

Re: [sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread Michael Bayer
On Sep 2, 2010, at 6:51 PM, cd34 wrote: meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, User_job_progress.job_id==Job.job_id)).filter(User_job_progress.fb_uid==1) results in a query of: FROM xxx_jobs LEFT OUTER JOIN

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
Just not having a lot of luck here. :) meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, and_(User_job_progress.job_id==Job.job_id, User_job_progress.fb_uid==1))).all() results in: SELECT xxx_jobs.job_id AS xxx_jobs_job_id,

[sqlalchemy] Re: SQLAlchemy-0.6.3-py2.6 postgresql+pg8000

2010-09-02 Thread ddarko
thanks for the advice. for the curious: the problem is in reading few rows pgARRAY. Table company Column |Type | Modifiers phone | character varying(150)[]| not null ... from pg8000 import DBAPI conn = DBAPI.connect(host=localhost, user=x,

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
% for job,progress in tmpl_context.jobs: error on my part after the outerjoin. Thanks for the pointers in the right direction. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To