Skip to content

Update a (custom) dictionary in a dict-of-dict model #6321

Answered by zzzeek
doc0815 asked this question in Usage Questions
Discussion options

You must be logged in to vote

so....just looking at this and I don't deal with the assoc proxy stuff very often, the assoc proxy is a "proxy" for a real underlying collection, and the proxy itself doesnt actually implement the storage:

# without any MyDict involved
(Pdb) type(curve.items)
<class 'sqlalchemy.ext.associationproxy._AssociationDict'>
(Pdb) type(curve.items[d])
<class 'sqlalchemy.ext.associationproxy._AssociationDict'>

Since your inner dictionary is also an attribute mapped collection, that's based on plain dict so that's the part where you need to inject your sorted dictionary. that is, the dictionary you "see" from the association proxy is always going to be AssociationDict. The "creator" / "getset_fac…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@doc0815
Comment options

@zzzeek
Comment options

@doc0815
Comment options

Answer selected by doc0815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants