Re: [Sqlalchemy-tickets] [sqlalchemy] #2808: AssociationProxy should use keywords on create
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-08-26 07:57:06
|
#2808: AssociationProxy should use keywords on create
-----------------------------------+----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: reopened
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Comment (by schlamar):
I think this is rather a workaround than a solution in case of an
association object because it is really unintuitive.
From a user point of view the "association proxy" pattern shouldn't be
this complex. Essentially you say: proxy this attribute as a collection
via a many-to-many mapping. When a user pass an object to this collection,
SQLAlchemy should know how to build the many-to-many relationship without
requiring manual configuration from the user.
So IMO the creation process in case of an association object should behave
something like this (with !User/Keyword example)
{{{
#!python
def _create(keyword):
# create association object (UserKeyword)
# do not pass the value
uk = self.creator()
# automatically find out how Keyword is related with
# UserKeyword and set the correct attribute
uk.find_relationship_and_set(keyword)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:10>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|