On May 22, 2013, at 4:51 PM, Burak Arslan <burak.ars...@arskom.com.tr> wrote:

> Hi,
> 
> I've just implemented support for scalar collections for Spyne. (In Spyne 
> terms that's sql serialization of an array of primitives). Seems to be 
> working fine so far.
> 
> The question is: Is the association proxy the only (read/write) way of doing 
> this? It requires the child table to be mapped, which requires the child 
> table to have a primary key, which is sometimes completely useless. I also 
> have to create another implicit attribute so that the association proxy can 
> fetch the value off of it.

Saw this yesterday and forgot to get to it.

Your primary key is far from useless.  If your collection consists of unique 
values, then that's your primary key.  If your collection consists of 
non-unique values, but are unique to their parent, then again, that's your 
primary key (a composite).   If your collection consists of non-unique values 
within a single parent, then you can't manipulate that data correctly since you 
can't target individual rows.

So its simple and straightforward just to map to that primary key.  SQLAlchemy 
could someday provide some out of the box system that does the mapping and 
association proxy for you but it's really not that big a deal to automate this 
yourself.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to