Hi all, this is my first post to this list. Finally I was convinced to migrate from sqlobject to sqlalchemy but haven't dived into sqlalchemy yet, just contemplating how my migration should go. I guess db/class definition will be straightforward, converting most of the queries too, but there are a couple of things I could locate in my sqlobject code that might need special treatment. I'd very much appreciate some comments on these with a view towards a sqlalchemy n00b like myself. I mean best practices, general philosophy and the like :)
1. I have a number of tables/objects and these all share some common fields/properties. For example, there are different types of objects but all can be commented on, so all tables of these objects should have a comment_id field and all corresponding classes should have a comment_count( ), last_comment( ) method. In sqlobject I could solve this by ordinary python inheritance, I defined a mixin with the right properties/methods and any object that needed comments subclassed not only SQLObject but also this mixin. In this way I didn't need to add these fields/methods/properties to each table definition. How would I do something similar in sqlalchemy? 2. In sqlobject I had a query which is simple in SQL but complicated through sqlobject. It was the following: let's say there is a zoo, which has some cages, each cage has a couple of animals in it, and each animal has a number of legs. All of this is stored in a database in an obvious way. How do I select the total number of legs in a zoo using one query with sqlalchemy? Right now only these non-straightforward things came to mind but I'm sure I'll be back with more questions as the actual migration starts going :) Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
