On 5/18/07, Greg Lindstrom <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am attempting to create tables for an application I am writing to help my
> wife track her home business. I want a a table to hold some client
> information (Client), with multiple joins to a table holding phones, emails,
> and addresses (allowing multiple associations for each back to the client).
> Here are the classes out of model.py (some field removed for clarity)
>
--8<-- snip --8<--
>
> When I run tg-admin sql create I get the address, client, email, and phone
> tables, as well as a address_client table. I am expecting an email_client
> and phone_client but I don't see them. Am I correct to assume I should get
> a join tables for the other two? And, if so, am I doing something wrong in
> my class definitions? I've looked at this for a couple days now and just
> don't see it.
My SQLObject is a little rusty, but I believe that if you have a
RelatedJoin, it should be defined as RelatedJoin in both classes. So
where you have `phones = MultipleJoin('Phones')` in your Client class
it should be `phones = RelatedJoin('Phones')` and the same goes for
the other many-to-many joins you have.
>
> Related to this, since I am just learning this, should I make the effort to
> use SQLAlchemy in place of SQLObject?
>
In my opinion, yes. SA will be the future default ORM for TG so you
should probably start using it now if you want to learn the defaults.
SO will still be supported though, so if you really prefer it to SA
you can use it instead. SA is a little more verbose when defining
your tables and objects, but the flexibility and power that you get is
definitely worth the extra typing :)
Lee
--
Lee McFadden
blog: http://www.splee.co.uk
work: http://fireflisystems.com
skype: fireflisystems
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---