On Wed, 2007-04-18 at 19:39 -0700, Mike Orr wrote: > That's the developer's problem, not yours. I stopped using relations > when I found out MiddleKit did the same. I just select from one table > at a time and handle the relations in Python. It means more database > queries but I'd rather work in Python than complicated SQL, and it > makes it easier to recover if a record is missing in one of the > related tables.
This is totally wrong (and reminds me of DHH's "hash in the sky" arguments, which are a fundamental reason I'll never consider Rails for any application, ever). First of all, databases have decades of theory and development to optimize relational operations that your Python code doesn't have. If your application ever needs to scale you'll be required to throw more hardware at it much sooner. Also, a SQL join is about 1/10th as complicated (and probably 1000 times as fast) as the equivalent Python code. As far as being easier to recover if a record is missing, this simply indicates that you haven't setup your relations correctly, otherwise "missing records" could not happen (specifically, foreign key constraints and cascading deletes would prevent this). My guess is that you cut your teeth on MySQL (or some other toy database) and don't really appreciate the power and data integrity features a true RDBMS can bring (I speak coming from a similar learning path, BTW, having used MySQL for a few years before rediscovering PostgreSQL). Note that I'm not one of those database guys who thinks you should write your entire application "in the database" using stored procedures, views and whatnot (although I've done that as well). However, your data relations and constraints *absolutely* belong there. I'd also like to point out that there's a fundamental contradiction in your position: you want to code relational constraints in your app *and* you want external apps to be able to share the database. This is practically begging for data integrity issues. How can the external app know about constraints embedded in another, unrelated application? Short answer is that it can't, which means that any integrity rules defined there will likely be violated, resulting in unexpected behaviour in one or both applications and undoubtedly lots of hand-fixing of data at some point. Sorry if I'm coming across strong on this, but you really, really need to let this idea go. It's fundamentally bad and you *will* eventually rue the day (hopefully not as many times as I had to before I learned my lesson). Regards, Cliff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
