Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-07 Thread Michael Bayer
On Dec 7, 2011, at 2:53 AM, kris wrote: I am using a single table scheme to store for a set of resource types. I would like to load a specific class if a mapper is defined and use the base class if no more specific version can be found. Is there a way to do this? i.e. resource =

[sqlalchemy] Association Objects

2011-12-07 Thread Julian Berman
Hi there :). Running into a bit of trouble trying to grasp how to manipulate association objects properly. I've really got two separate questions, but hopefully it's clear enough that I can ask them both properly. Given the following example: class Event(Base): name = Column(Unicode,

Re: [sqlalchemy] Association Objects

2011-12-07 Thread Michael Bayer
On Dec 7, 2011, at 2:07 PM, Julian Berman wrote: So, when searching, I see some results that seem to ask this question, though none of the solutions are for recent versions of sqlalchemy, so, I may as well just ask :): how could I have Location.events be order_by'd via Event.date? Well

Re: [sqlalchemy] SQLA 0.6.8 Given an AssociationProxy, how can I get the class it would give me?

2011-12-07 Thread Michael Bayer
On Dec 7, 2011, at 7:53 PM, Hector Blanco wrote: Hello everyone: In one of my classes, I am using an associationproxy to provide a list in which the same item can be inserted twice. Basically, a product can contain images (several times the same image). One product can have two different

[sqlalchemy] Re: Association Objects

2011-12-07 Thread Julian
Thanks for the reply! On Dec 7, 8:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: Well your EventOccurence has event_name already there as the primary key soorder_by=event_name:     location = relationship(Location,        backref=backref(            event_occurences,            

Re: [sqlalchemy] SQLA 0.6.8 Given an AssociationProxy, how can I get the class it would give me?

2011-12-07 Thread Hector Blanco
Yes! Thank you for your, as usual :-) , quick, wise and right reply! I believe that's all I need. I already have in place all the machinery to deal with Columns, relationships, and stuff like that! Awesome (or as we would pronounce in my mother tongue, Spanish... osom!! ) 2011/12/7 Michael Bayer

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-07 Thread kris
Hmm, I think I want the opposite behavior. I was the defualt mapper to Resource unless a more specific mapper has been defined. I never defined a 'C' or 'D' and I would like simple get a Resource when no better mapper is found. i.e. I get Resource class for C, D and get a Resource_A for A and