Paul Johnston wrote:
> One decision we need to make for TG1.1 is whether the default ORM
> should be plain SA or Elixir. (I'm sure I don't need to explain what
> these are on this list!) This is your chance to have your voice heard
> so, speak up :-)
Oh dear, lets keep it civil people! :)
> It's generally agreed that we should pick an option that is easy for
> beginners to grasp, and deals with 90% of use cases.
Well, if those are really the concerns, then I would argue the
following:
* Plain SQLAlchemy is not easy for beginners to grasp, even with the
wealth of documentation that it has. Its designed for people who
are experienced with relational databases, and many beginners are
not.
* Elixir is only easier for beginners to grasp for the first week or
so until they get to the point where they have to start consulting
the SQLAlchemy documentation to learn how to perform complex
queries.
We aren't going to find something out there today that satisfies the
stated goal of being easy for beginners *and* solving 90% of use cases,
except for maybe SQLObject or Storm. I think thats just the current
state of things.
> Elixir lets you define your model more concisely, and more in line
> with other ORMs like SQLObject. The big question is whether Elixir is
> actually simpler, or if it's just shorthand for people who already
> know SA.
Elixir is SQLAlchemy. Thats the bottom line. In order to really use
Elixir effectively, you are going to have to understand SQLAlchemy
and its core concepts. What Elixir provides is an alternative
syntax for defining your tables, objects, and mappers in one step.
Once you have defined your model, the usage patterns are very
similar, with the exception of Elixir's shortcut for getting a Query
object: `MyEntity.query` rather than `session.query(MyEntity)`.
> There are also practical concerns, e.g. that Elixir classes cannot
> fully mix with plain SA classes, and that Elixir is not as well
> documented as SA. These are fixable; perhaps we should wait until they
> are fixed before making Elixir the default.
This is a valid concern. Elixir is a younger project than SQLAlchemy,
and thus its documentation is a bit behind. Having bi-directional
integration with plain SQLAlchemy is definitely one of Elixir's goals,
but we just haven't gotten there yet.
Now, as for what the default should be in TurboGears 1.1 and 2.0. I
am of the opinion that TurboGears has been moving away from being a
beginner-driven framework for some time. Therefore, I don't think the
original goal is a valid one any more. For people who want something
super-easy to jump into that will solve the majority of their use cases
without being complex, they should likely go with something like Django
or Ruby on Rails, which are all about sacrifice and convention for the
sake of development speed. TurboGears is about sane defaults that you
can escape from, in my opinion.
My recommendation would be that TurboGears 1.1 and 2.0's default
templates generate a model.py that instantiates an SQLAlchemy session
and metadata, and then provides two commented out sections that show you
how to either get started with plain SQLAlchemy, or use the provided
session and metadata to define your model with Elixir.
The nice thing about an approach like this is that it doesn't really
matter if the user is doing plain SA or Elixir, the framework knows
about the metadata and session, and can use that knowledge to provide
things like integrated automatic transactions.
If people think that we absolutely must pick one default, then I'd say
that going with plain SQLAlchemy would probably be the wiser decision
at this point, simply because I think that there are more current
TurboGears users using plain SQLAlchemy than Elixir.
Either way, I think TurboGears 1.1 and 2.0 should allow users to make
their own choice.
--
Jonathan LaCour
http://cleverdevil.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---