package com.sony.etl;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;

import com.google.cloud.bigtable.hbase.BigtableConfiguration;

public class BigTableClient {

	public static void main(String args[]) throws Exception {
		Configuration conf = BigtableConfiguration.configure("dsp-automation", "bigtable-dsp-automation-demo");
	    Connection connection = BigtableConfiguration.connect(conf);
	    //test-bt-raghu-aggr, 
			Table table = connection.getTable(TableName.valueOf("spotify_aggregation"));
			//QM72816271102019-03-03ad~theorchard
			//CAM4604017212019-03-03ad~theorchard
			Result getResult = table.get(new Get(Bytes.toBytes("ARC2C1900001~2019-03-05~ar~theorchard")));
			System.out.println("json == " + Bytes.toString(getResult.getValue(Bytes.toBytes("json"), Bytes.toBytes("data"))));
			/*customer.setFirstName();
			customer.setLastName(Bytes.toString(getResult.getValue(Bytes.toBytes("name"), Bytes.toBytes("lastName"))));
			customer.setAddress(Bytes.toString(getResult.getValue(Bytes.toBytes("address"), Bytes.toBytes("address"))));
			return customer;*/
		
	}
}
