Thanks for the response. I was just afraid it had fallen through the
cracks. I won't get so uptight next time.
On Apr 17, 12:41 pm, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> The suggest the following syntax for this:
>
> class B(Entity):
> a_id = Field(Integer, colname='a', ForeignKey('a.id'))
> a = ManyToOne('A', column=a_id)
I agree. This is clean and clear.
> or would "field=a_id" be more logical?
I tend toward using field= because it's referring to the Elixir Field
and not the SQLAlchemy Column.
> As for the ForeignKey issue, I suggest that the foreignKey is left to
> the user to define, though I'm really not sure about this point. I
> should think more about the pro and cons of this...
It would be nice if Elixir would still create the ForeignKey (if it
hasn't been declared). This would allow the user to create it if he
so chooses, but it also saves the user from having to know the name of
the target table and the names of the primary keys (which may have
been programmatically generated). Elixir already determines these
things automatically, so with some simple refactoring, it should be
fairly easy to allow the user not to declare the ForeignKey. In other
words, it minimizes the syntax required to rename the column name in
the mapper, which is the primary goal in this effort.
I don't immediately see any downsides to allowing the ForeignKey to be
optionally declared, except that it does slightly complicate the
implementation.
If I can find the time this weekend, I'll see if I can draft something
that implements this behavior.
Regards,
Jason
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---