HBase put method authorization

#1

Hi,

I am trying to load data to HBase using the HBase.put() API. However, I get an error since the API is only available for some roles (namely C3.Role.Developer, C3.Role.ReadAll, C3.Role.Impersonator, C3.Role.Console, C3.Role.TenantAdmin, C3.Role.UserAdmin, DefaultAccessRole). Is there a way to overcome this issue in a development enviroment?

I already tried remixing the type HBase removing the annotation @action(group='cluster-admin') but it does not work as HBase is a platform type.

Thanks

0 Likes

#2

You will not be able to remix/modify the HBase type as it is a platform type.

When writing to HBase, are you writing through an application type (e.g. AppType.create()) or calling HBase.put() directly?

0 Likes

#3

After further examination the HBase credentials do not have write permissions to that table.

0 Likes

#4

This is the script I’m trying to run:

JS.exec((function(){ 	
    	var connectionName = "hbconForPI";
    	var tables = {};
    	// Create a connection instance
    	var connection = HBase.make(connectionName).connect();

    	try {
            tables = connection.listTables();
        } catch (e) {
            connection.close();
            connection = HBase.make(connectionName).connect();
        }

    	var outputTable = "generation:tgx_output_advanced_analytics";

    	var rowKey = "\\\\pi_concentratore_esercizio\\PG22.HAM2.ACC1.B4.AMP|2018-08-01";
    	
    	var colsOutput = [HBaseColumn.make({name:"PItagName", value: "test"}),
    				 //HBaseColumn.make({name:"Good", value: "test"}),
    				 HBaseColumn.make({name:"KeyTimestamp", value: "test"}),
    				 //HBaseColumn.make({name:"KeyUNIXtime", value: "test"}),
    				 //HBaseColumn.make({name:"PIserverName", value: "test"}),
    				 //HBaseColumn.make({name:"PItagName", value: "test"}),
    				 //HBaseColumn.make({name:"Questionable", value: "test"}),
    				 //HBaseColumn.make({name:"Substituted", value: "test"}),
    				 //HBaseColumn.make({name:"Timestamp", value: "test"}),
    				 //HBaseColumn.make({name:"UnitsAbbreviation", value: "test"}),
    				 HBaseColumn.make({name:"Value", value: "test"})
    				];

    	var cFamOutput = HBaseColumnFamily.make({name: "data", columns: colsOutput});

    	var attempt1 = connection.put(rowKey, outputTable, [cFamOutput]);
    	
    	return attempt1; 
    }).toString());

where “hbconForPI” is the ID for the HBaseConnectionConfig Type which defines the parameter fot the HBase connector and contains the credentials for writing persimissions

0 Likes