I don't quite understand the motivation for deprecating column_format
in favor of explicit column names.
I see the value of local and remote column naming. I also see the
value in M2MCOL_NAMEFORMAT.
But by deprecating column_format, a gap in functionality is created,
where one might like to specify the local and remote column names per
M2M table, but would like to define them without duplicating content
(i.e. relative to the Entities they reference).
For example,
class Movie(Entity):
# primary keys and fields defined here
class Director(Entity):
# primary keys and fields defined here
movies = ManyToMany('Movie', column_format="%(key)s")
class SuperHero(Entity):
# primary keys and fields defined here
movies = ManyToMany('Movie', column_format="%(key)s_%(entity)s")
While I acknowledge that this database design is not regular, it's not
unreasonable to think that such a database might have been engineered.
As I understand it, future versions of Elixir will require
column_format to be replaced by explicit remote_colname and
local_colname references, which will create additional dependencies
that will have to be maintained manually for consistency. For example,
if the name of the SuperHero class were to be changed, the
column_format would also have to be changed accordingly, whereas with
column_format, this was not necessary.
The M2MCOL_NAMEFORMAT option will not help much in this case. It will
allow one class to have column names defined relative to the related
class objects, but all others must be assigned explicitly. While this
option encourages better database design, it teases Elixir users by
when the database can't be made regular by making a format string
available, but only globally.
Is there a reason that column_format must be deprecated (is the
implementation unnecessarily messy for it)? Is it possible that the
local_colname and remote_colname could also support format strings?
Or is it possible that I've misunderstood the usage, and this
deprecation isn't an issue at all?
--
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=.