[sqlalchemy] Re: How to get list of relations

2007-10-31 Thread Paul Johnston
Hi, You are missing a compile call before you can iterate properties. try adding: Ah, that is indeed the problem. With that in place, iterate_properties does very nearly what I need. The only problem is that I need to get the name of the relation as well. For now, the following works: [(a,b)

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Roger Demetrescu
Hei Wes and Paul... On 10/29/07, Wes Duff [EMAIL PROTECTED] wrote: Hey whats going on. I am a new sqlalchemist as well but lets see if this helps any. This is how I am getting a list of all names that corrispond with my document names class. names = [ c.name for c in

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 10:16 AM, Roger Demetrescu wrote: If we need to introspect both Address-user and User-addresses, one solution is to not use the backref ... : use mapper.get_property(name) and mapper.iterate_properties(). I've considered removing properties as a public accessor

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Mike, use mapper.get_property(name) and mapper.iterate_properties(). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs: [Column('id', Integer(), primary_key=True, nullable=False)] [Column('val',

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Hi, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. Ok, I found a hacky way that does what I need: [(n, getattr(obj, n)) for n in dir(obj) if isinstance(getattr(obj, n),

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Paul Johnston
Hi, Ok, I found a hacky way that does what I need: [(n, getattr(obj, n)) for n in dir(obj) if isinstance(getattr(obj, n), sqlalchemy.orm.attributes.InstrumentedAttribute)] Ooops, not quite what I need. How do I go from a CollectionAttributeImpl to a mapper? Paul

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Michael Bayer
On Oct 30, 2007, at 11:25 AM, Paul Johnston wrote: Mike, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs: [Column('id',

[sqlalchemy] Re: How to get list of relations

2007-10-30 Thread Gaetan de Menten
On 10/30/07, Paul Johnston [EMAIL PROTECTED] wrote: Mike, use mapper.get_property(name) and mapper.iterate_properties (). I've considered removing properties as a public accessor since it serves no useful purpose. This doesn't work for me - the following code outputs:

[sqlalchemy] Re: How to get list of relations

2007-10-29 Thread Wes Duff
Hey whats going on. I am a new sqlalchemist as well but lets see if this helps any. This is how I am getting a list of all names that corrispond with my document names class. names = [ c.name for c in model.Document.select_by(param=param) ] So I am just collecting all the names from my Document