title: How to insert data into Hbase tables using PHP Stargate client
body: <p>I'm playing around with an install of HBase cluster, and am trying to access the data via the Stargate REST interface.  Most of the read-only functions (i.e. listing tables, getting version, meta data, etc) are work nicely.  However, I'm having trouble with actually inserting data into any tables I've created.  Here's what I've got so far....</p>
  
  <p>Created a dummy table with two columns, as follows:</p>
  
  <pre><code>$table_schema = &lt;&lt;&lt;SCHEMA
      &lt;TableSchema name="mytable" IS_META="false" IS_ROOT="false"&gt;
          &lt;ColumnSchema name="info" BLOCKSIZE="65536" BLOOMFILTER="false" BLOCKCACHE="false" COMPRESSION="NONE" LENGTH="2147483647" VERSIONS="1" TTL="-1" IN_MEMORY="false" /&gt;
          &lt;ColumnSchema name="url" BLOCKSIZE="65536" BLOOMFILTER="false" BLOCKCACHE="false" COMPRESSION="NONE" LENGTH="2147483647" VERSIONS="1" TTL="-1" IN_MEMORY= "false"/&gt;
      &lt;/TableSchema&gt;
  SCHEMA;
  
  require_once "HTTP/Request.php";
  $request = new HTTP_Request("http://localhost:8080");
  $request-&gt;setMethod(HTTP_REQUEST_METHOD_PUT);
  $request-&gt;addHeader("Accept", "text/xml");
  $request-&gt;addHeader("Accept", "text/xml");
  $request-&gt;setBody($table_schema);
  $request-&gt;sendRequest();
  </code></pre>
  
  <p>The table creation works fine.  Next, I want to insert some data into my new table.  Here's how I attempt to do it:</p>
  
  <pre><code>$row_key = base64_encode("higgilty");
  $column_name = base64_encode("info");
  $value = base64_encode("Here is a test value");
  
  $data = &lt;&lt;&lt;DATA
       &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
       &lt;CellSet&gt;
           &lt;Row key="$row_key"&gt;
               &lt;Cell column="$column_name"&gt;
                   $value
               &lt;/Cell&gt;
           &lt;/Row&gt;
       &lt;/CellSet&gt;
  DATA;
  
  require_once "HTTP/Request.php";
  $request = new HTTP_Request("http://localhost:8080/mytable/higgilty");
  $request-&gt;setMethod(HTTP_REQUEST_METHOD_PUT);
  $request-&gt;addHeader("Accept", "text/xml");
  $request-&gt;addHeader("Accept", "text/xml");
  $request-&gt;setBody($data);
  $request-&gt;sendRequest();
  </code></pre>
  
  <p>The result of this request returns a 503 error, with the following exception:</p>
  
  <pre><code>[...] org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException: Column family  does not exist in region [...]
  </code></pre>
  
  <p>The error is pretty clear, but I am not sure what is wrong with my schema posted above.</p>
  
  <p>I also wonder if I'm better off using the Thrift package and generating necessary PHP client files instead of using Starbase?  If anyone has any experience with this I'd love to hear from you.</p>
  
  <p>Any help is greatly appreciated.</p>