I am moving this thread over to [EMAIL PROTECTED] to continue the discussion, so please reply over there :)
Ed Singleton wrote: > As someone who was resisting moving to SQLAlchemy due to the apparent > complexity, I've had a look through the introduction and the sample TG > app, and this looks wonderful. I'm now eager to move to this as the > syntax now looks preferable to SQLObject (and writing my model is 90% > of what I do with the ORM). Fantastic! I am very pleased to hear that you like the direction we are going. > A few points that came up as I was going through the docs and example: > > - You asked whether people preferred the with_fields or has_field > style. I much prefer the with_fields style as it makes the code much > more 'scannable'. Yes, we had this same discussion internally and I think we were split on what to do. Personally, I think they both have their merits, and have really tried to use both of them in practice to see if one comes out a clear leader in my mind. I used to be 100% behind the with_fields syntax, but have come around a bit to the has_field syntax, which I find more readable. Anyway, we might just end up keeping both... > - The has_many statement immediately makes sense, but the belongs_to > and has_and_belongs_to_many statements don't make obvious sense. It > took me a while to get my head round them. I think in general trying > to use natural language for things like this is a nice friendly thing > for extreme newcomers, but tends to prevent them from understanding > what is really going on. Also, unless the metaphors used are very > accurate, they can actually be misleading. Movies don't belong to a > Genre. There just happens to point to another. Maybe an optional set > of statements with clearer meanings would be a useful addition? We originally had such aliases, but then you end up having to document the five or six synonyms for each relationship type, so we took them out. It is very easy to create your own aliases, if you want: from elixir import has_many as owns_a_bunch_of or, even: from elixir import has_many owns_a_bunch_of = has_many This should allow you to clearly pick whatever descriptive term you like to describe your models, and people can easily scan through your imports to figure out which relationship type they are dealing with. > - Because the has_many, belongs_to and has_and_belongs_to_many > statements are all quite different lengths, it makes it harder to scan > through them. If they were all similar lengths it would make it more > readable. (Particularly as, when formatted according to PEP8, this > syntax has very little whitespace) Yes, I totally understand this complaint. We all had similar thoughts, but couldn't come up with anything better. Keep in mind that there is prior art here with Rails' ActiveRecord, which uses the same relationship names as we do. It seems like they also couldn't find anything better :) Of course, we are always open to suggestion. > As it is though, this is wonderful. Thank you. I'm going to start > using it very soon, and I guess I can override the statements easily > enough (that won't break anything will it?). Great, and no, overriding statements shouldn't break a thing. Watch my blog today as well, because I am going to be posting a quick tutorial on creating your *own* DSL statements for your model objects. -- Jonathan LaCour http://cleverdevil.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---