Is column update column-atomic or row atomic?
Sorry for the rather primitive question, but it's not clear to me if I need to fetch the whole row, add a column as a dictionary entry and re-insert it if I want to expand the row by one column. Help will be appreciated. -- View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6174445.html Sent from the cassandra-u...@incubator.apache.org mailing list archive at Nabble.com.
Re: Is column update column-atomic or row atomic?
On Tue, Mar 15, 2011 at 5:46 PM, buddhasystem wrote: > Sorry for the rather primitive question, but it's not clear to me if I need > to fetch the whole row, add a column as a dictionary entry and re-insert it > if I want to expand the row by one column. Help will be appreciated. > > > -- > View this message in context: > http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6174445.html > Sent from the cassandra-u...@incubator.apache.org mailing list archive at > Nabble.com. > No. In Cassandra you do not need to read to write. You should try to avoid it if possible.
Re: Is column update column-atomic or row atomic?
Thanks. Can you give me a pycassa example, if possible? Thanks! -- View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6174487.html Sent from the cassandra-u...@incubator.apache.org mailing list archive at Nabble.com.
Re: Is column update column-atomic or row atomic?
> Sorry for the rather primitive question, but it's not clear to me if I need > to fetch the whole row, add a column as a dictionary entry and re-insert it > if I want to expand the row by one column. Help will be appreciated. As was pointed you, reading and re-inserting is definitely not the way to go. But note that when inserting a column, there is never going to be a guarantee that other columns are not inserted/deleted concurrently by other writers (unless there is external synchronization). Your question makes me believe you're trying to ensure some kind of consistency across multiple columns in a row. Maybe if you describe your use-case. -- / Peter Schuller
Re: Is column update column-atomic or row atomic?
Hello Peter, thanks for the note. I'm not looking for anything fancy. It's just when I'm looking at the following bit of Pycassa docs, it's not 100% clear to me that it won't overwrite the entire row for the key, if I want to simply add an extra column {'foo':'bar'} to the already existing row. I don't care about cross-node consistency at this point. insert(key, columns[, timestamp][, ttl][, write_consistency_level])¶ Insert or update columns in the row with key key. columns should be a dictionary of columns or super columns to insert or update. If this is a standard column family, columns should look like {column_name: column_value}. If this is a super column family, columns should look like {super_column_name: {sub_column_name: value}} -- View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6179492.html Sent from the cassandra-u...@incubator.apache.org mailing list archive at Nabble.com.
Re: Is column update column-atomic or row atomic?
insert() will only overwrite (or insert) the columns that you supply in the dictionary. So, if you do: cf.insert('key', {'foo': 'bar'}) and the column 'foo' doesn't exist in that row yet, the column will simply be added to the other columns in the row. On Wed, Mar 16, 2011 at 9:00 PM, buddhasystem wrote: > Hello Peter, thanks for the note. > > I'm not looking for anything fancy. It's just when I'm looking at the > following bit of Pycassa docs, it's not 100% clear to me that it won't > overwrite the entire row for the key, if I want to simply add an extra > column {'foo':'bar'} to the already existing row. I don't care about > cross-node consistency at this point. > > insert(key, columns[, timestamp][, ttl][, write_consistency_level])¶ > >Insert or update columns in the row with key key. > >columns should be a dictionary of columns or super columns to insert or > update. If this is a standard column family, columns should look like > {column_name: column_value}. If this is a super column family, columns > should look like {super_column_name: {sub_column_name: value}} > > -- > View this message in context: > http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6179492.html > Sent from the cassandra-u...@incubator.apache.org mailing list archive at > Nabble.com. > -- Tyler Hobbs Software Engineer, DataStax <http://datastax.com/> Maintainer of the pycassa <http://github.com/pycassa/pycassa> Cassandra Python client library
Re: Is column update column-atomic or row atomic?
Thanks for clarification, Tyler, sorry again for the basic question. I've been doing straight inserts from Oracle so far but now I need to update rows with new columns. -- View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Is-column-update-column-atomic-or-row-atomic-tp6174445p6179536.html Sent from the cassandra-u...@incubator.apache.org mailing list archive at Nabble.com.