On Mon, Jul 24, 2017 at 6:01 PM, Ruben Di Battista
wrote:
> Would cause again an IntegrityError. So I modified the recipe like this:
>@event.listens_for(Session, "after_attach")
>def after_attach(session, instance):
># when UserCourse objects are attached to a Session,
># f
I'm playing a bit with composite Association Proxies and stumbled upon this
discussion. Just wanted to point out that here:
@event.listens_for(Session, "after_attach")
def after_attach(session, instance):
# when UserCourse objects are attached to a Session,
# figure out what Co
Decided to handle this via the controller because it seems to be the most
straightforward method (check if the association exists; if it doesn't,
create it; done).
I was thinking there might be a way to do it automatically via a listener
in the schema, but the mechanics of such a solution are e
Mike,
It took a few hours to wrap my head around your work and adapt it to my
actual use case, but it's working great now...except for a particular case
when used with templates.
Basically, I'm querying for relevant courses and then iterating over the
results to construct a form for grade entr
Well, if it isn't the man himself. Mike, you're awesome -- thanks for the
hand-holding. Thanks for reading into my use case and providing the second
example.
Also, thanks for the thorough documentation (on SQLAlchemy and Mako). This
would be infinitely more difficult without it.
On another not
OK well to do it exactly the way the example does it, each time we create a
UserCourse, it will also create a Course. That’s pretty simple, we use two
association proxies, one for User.courses and the other for UserCourse.course,
mappings are like this:
class User(Base):
__tablename__ = 'u
Hi, all. I've been trying to modify the example of a composite association
proxy
(http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html#composite-association-proxies)
to fit my needs.
In the documentation example, there is a User object, a Keyword object, and
a UserKeyword assoc