On Feb 25, 4:28 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> On Fri, Feb 22, 2008 at 11:34 PM, dundeemt <[EMAIL PROTECTED]> wrote:
>
> > Ok, maybe I'm answering my own question -- but I have not idea if it
> > is correct.
>
> > class Addresses(Entity):
> > using_options(tablename='addresses')
>
> > custnmbr = ManyToOne('Customers', Unicode, primary_key=True)
>
> > adrscode = Field(Unicode, primary_key=True)
> > address1 = Field(Unicode)
>
> > class Customers(Entity):
> > using_options(tablename='customers')
>
> > custnmbr = Field(Unicode, primary_key=True)
> > custname = Field(Unicode)
> > ...
> > addresses = OneToMany('Addresses')
>
> > elixir will successfully create the tables and relationships, but have
> > I done what I was trying to do?
>
> I think so.
>
> > Specifically, is the forward relationship proper?
>
> Sorry for the slow reply, but this seems fine EXCEPT for the ManyToOne
> line, which should read:
> custnmbr = ManyToOne('Customers', primary_key=True)
> ie, you shouldn't specify it's type (Unicode) since it will
> automatically take the type of the referenced column(s).
>
Thanks, -- watching the debug messages lead me to that conclusion, and
I got it working.
The fk definition is used automatically in the child of the relation
-- which makes absolute
sense. please correct me if I'm wrong.
-jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---