Re: [sqlalchemy] implementing implicit scalar collections
Hi Mike, On 05/25/13 17:59, Michael Bayer wrote: 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. OK, just wanted to make sure. In that case, it'd be best to store an array of primitives as native postgres ARRAY objects if one wants to trade off the overhead of primary keys for the overhead of re-writing the whole array on every update. Another feature request for Spyne, I guess :) 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. I guess I've already done that automation. I do create the table, the mapping and the association proxy automatically. Thank you for your response. Best, Burak -- 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.
Re: [sqlalchemy] implementing implicit scalar collections
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.
[sqlalchemy] implementing implicit scalar collections
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. Here's the relevant bit: https://github.com/plq/spyne/blob/master/spyne/util/sqlalchemy.py#L563 Here's its test: https://github.com/plq/spyne/blob/master/spyne/test/test_sqlalchemy.py#L917 Setting both columns as primary keys breaks the test: https://gist.github.com/plq/5630698#file-spyne-patch column_property is read-only, so I can't use it. Any suggestions? Another question, instead of deleting, it seems to be updating foreign keys to null and re-inserting data. Why not just delete the old values? Best regards, Burak -- 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.
[sqlalchemy] implementing implicit scalar collections
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. Here's the relevant bit: https://github.com/plq/spyne/blob/master/spyne/util/sqlalchemy.py#L563 Here's its test: https://github.com/plq/spyne/blob/master/spyne/test/test_sqlalchemy.py#L917 Setting both columns as primary keys breaks the test: https://gist.github.com/plq/5630698#file-spyne-patch column_property is read-only, so I can't use it. Any suggestions? Another question, instead of deleting, it seems to be updating foreign keys to null and re-inserting data. Why not just delete the old values? Best regards, Burak -- 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.