Is it possible to delete column / column family with mutator_set_cells_as_arrays

18 views
Skip to first unread message

Galfy Pundee

unread,
Aug 2, 2012, 10:47:24 AM8/2/12
to hyperta...@googlegroups.com
Hi guys,
Is it possible to delete a column or a column family by using
mutator_set_cells_as_arrays? Is it possible to do something like this:

<code>
client = ThriftClient('localhost', 38080)
namespace = client.namespace_open("<namespace>")

mutations = []
mutations.append(['00001', 'column', 'family', KeyFlag.DELETE_CF])

mutator = client.mutator_open(namespace, "<table>", 0, 0)
client.mutator_set_cells_as_arrays(mutator, mutations)
client.mutator_flush(mutator)
</code>

May be I am wrong but I seem to recall that with the old syntax it was
possible to do something like this if you put instead of the family
name the key flag.

Regards,
Gal

Doug Judd

unread,
Aug 2, 2012, 2:12:13 PM8/2/12
to hyperta...@googlegroups.com
Hi Gal,

Yes, I believe it is possible, the string list for cells_as_arrays is as follows:

rowkey columnfamily columnqualifier value timestamp revision flags

You can either specify the timestamp (nanoseconds since epoch) or use the AUTO_ASSIGN value (-9223372036854775806).  You should use the AUTO_ASSIGN value for the revision.  The flags field can take one of the following values:

  static const uint32_t FLAG_DELETE_ROW            = 0x00;
  static const uint32_t FLAG_DELETE_COLUMN_FAMILY  = 0x01;
  static const uint32_t FLAG_DELETE_CELL           = 0x02;
  static const uint32_t FLAG_DELETE_CELL_VERSION   = 0x03;
  static const uint32_t FLAG_INSERT                = 0xFF;

So, to formulate the delete cell you list below, you would do something like:

mutations.append(['00001', 'column', 'family', '', '-9223372036854775806', '-9223372036854775806', '1'])

Give it a shot and let us know if it works.  We will also modify the code so that the timestamp and revision number can accept the string 'AUTO_ASSIGN' and string constants for the flags field as well.  This change will be available in the upcoming 0.9.6.1 release.

- Doug


--
You received this message because you are subscribed to the Google Groups "Hypertable Development" group.
To post to this group, send email to hyperta...@googlegroups.com.
To unsubscribe from this group, send email to hypertable-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hypertable-dev?hl=en.




--
Doug Judd
CEO, Hypertable Inc.

galfy

unread,
Aug 11, 2012, 11:27:52 AM8/11/12
to hyperta...@googlegroups.com, do...@hypertable.com
Thanks Doug. I tested it and it works. 
Reply all
Reply to author
Forward
0 new messages