[sqlalchemy] ordering by number of objects in a many-to-many relationship
Hi group, Is there an easy way of ordering objects by the number of objects that stand in a ManyToMany relationship with it? My use case is the following: I have two types of entities, tags and articles, that stand in a ManyToMany relation. I want to order the tags by the number of articles they label and then assign them different CSS classes depending on their popularity. I know how to do it in a lengthy and rather ugly way, but I suspect there should be an elegant way (I know a simple solution in SQL). Cheers and thanks in advance, -- Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fwd: [elixir] warnings on exit
On Dec 17, 5:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: Make sure you are closing all sessions that are created. Also, its important that you show us what the exact warnings youre getting are. Please send along a reproducing test case illustrating the full issue. I am sorry to admit it, but I cannot reproduce the warnings. I suspect that it may have something to do with the fact I have dropped and recreated the database in the meantime. Now I even don't have to close the session explicitly and everything works fine. Sorry for bugging you unnecessarily. Cheers, -- Richard -- Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fwd: [elixir] warnings on exit
On Dec 13, 5:49 pm, Michael Bayer [EMAIL PROTECTED] wrote: these are some cleanup messages which occur during the final gc of objects in the session. ive tried to work around them a bit but they still persist for some applications ( i havent yet been able to reproduce them and im hesitatnt to just squash all the exceptions entirely). they are harmless, but also can be prevented if you close() the session explicily before the app completes. No, it does not: closing the session was the first thing I tried. In my particular case the warnings *are* somewhat harmful: they make it a lot more difficult to read the effects of running the unit tests for my program. Of course, I can workaround it by sending stderror to stdoutput and piping it to less, but I am not completely happy about this solution. (Right now I am out of my office and I don't have access to my code or sqlalchemy version I am using... When I get there on Tuesday I will double check if closing the session doesn't help.) Best regards, -- Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~--~~~~--~~--~--~---