How this Proxy object is going to work exacly? Will that generate extra Sql or what? I assume that I should just change __getattr__() to desired and return Warehouse.key ? or warehouse_table.c.key?
On 13 Paź, 17:25, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Oct 13, 2008, at 11:14 AM, g00fy wrote: > > > > > > > I have my table Warehouse collumns like: > > id, owner_id .... , area_total, area_office ... ,area_storage > > I would like to have acces to all areas by Warehouse.area.property: > > example: > > Warehouse.area.storage > > > I did composite(), but now I can't filter like: > > filter(Warehouse.area.total >=100) and even not by > > fitler(Warehouse.area_total >=100) > > > but i can access > > Warehouse.area.total > > > I don't want to create aditional Area table, becouse that will create > > expensive joins. > > > Is there any way to connect a group of fields to another "virtual" > > relation? > > the functionality you describe is not built in to SQLA but you can > roll it yourself by building your own proxy object, along the lines of: > > class Warehouse(object): > ... > > class Proxy(object): > def __getattr__(self, key): > return getattr(Warehouse, key) > > Warehouse.area = Proxy() > > i wouldnt recommend composites since thats not a very well defined > feature with SQLA, though that usage is interesting, perhaps somehting > that can be implemented eventually. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
