*********************************************************************************
CREATE table in hbase using hive:
*********************************************************************************
create table hbase_wallets(Id BIGINT, MDN VARCHAR(20), Password VARCHAR(1000), eWalletId VARCHAR(20), Date TIMESTAMP, TransactionNumber VARCHAR(25), Requester VARCHAR(20), Instrument TINYINT, Status TINYINT, WalletType TINYINT, Opt1 VARCHAR(50), Opt2 VARCHAR(50), Opt3 VARCHAR(50), IsB2B BOOLEAN, UserId VARCHAR(50), Banks INT, WalletOwner INT, Currency TINYINT, INSERT_DT TIMESTAMP, UPDATE_DT TIMESTAMP, ACTIVE_FLAG CHAR(1))
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:MDN,cf1:Password,cf1:eWalletId,cf1:Date,cf1:TransactionNumber,cf1:Requester,cf1:Instrument,cf1:Status,cf1:WalletType,cf2:Opt1,cf2:Opt2,cf2:Opt3,cf2:IsB2B,cf2:UserId,cf2:Banks,cf2:WalletOwner,cf2:Currency,cf2:INSERT_DT,cf2:UPDATE_DT,cf2:ACTIVE_FLAG")
TBLPROPERTIES ("hbase.table.name" = "hive_wallets");
*********************************************************************************
To move data from hive to hbase:
*********************************************************************************
INSERT OVERWRITE TABLE hbase_wallets SELECT * FROM oxi_consolidated_orc.Wallets;
*********************************************************************************
CREATE table in hbase using hive:
*********************************************************************************
use default;
create EXTERNAL table hbase_actions(Id INT, description VARCHAR(80), insert_dt timestamp, update_dt timestamp, active_flag char(1))
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:description,cf1:insert_dt,cf1:update_dt,cf1:active_flag")
TBLPROPERTIES ("hbase.table.name" = "hbase_actions")
LOCATION 'wasb://linuxxxxxxhdinsightcluster@oxigxxxxxxcompute.blob.core.windows.net/test/actionshbasetest';
*********************************************************************************
To move data from hive to hbase:
*********************************************************************************
INSERT OVERWRITE TABLE hbase_wallets_test SELECT Id FROM oxi_consolidated.Wallets;
CREATE table in hbase using hive:
*********************************************************************************
create table hbase_wallets(Id BIGINT, MDN VARCHAR(20), Password VARCHAR(1000), eWalletId VARCHAR(20), Date TIMESTAMP, TransactionNumber VARCHAR(25), Requester VARCHAR(20), Instrument TINYINT, Status TINYINT, WalletType TINYINT, Opt1 VARCHAR(50), Opt2 VARCHAR(50), Opt3 VARCHAR(50), IsB2B BOOLEAN, UserId VARCHAR(50), Banks INT, WalletOwner INT, Currency TINYINT, INSERT_DT TIMESTAMP, UPDATE_DT TIMESTAMP, ACTIVE_FLAG CHAR(1))
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:MDN,cf1:Password,cf1:eWalletId,cf1:Date,cf1:TransactionNumber,cf1:Requester,cf1:Instrument,cf1:Status,cf1:WalletType,cf2:Opt1,cf2:Opt2,cf2:Opt3,cf2:IsB2B,cf2:UserId,cf2:Banks,cf2:WalletOwner,cf2:Currency,cf2:INSERT_DT,cf2:UPDATE_DT,cf2:ACTIVE_FLAG")
TBLPROPERTIES ("hbase.table.name" = "hive_wallets");
*********************************************************************************
To move data from hive to hbase:
*********************************************************************************
INSERT OVERWRITE TABLE hbase_wallets SELECT * FROM oxi_consolidated_orc.Wallets;
*********************************************************************************
CREATE table in hbase using hive:
*********************************************************************************
use default;
create EXTERNAL table hbase_actions(Id INT, description VARCHAR(80), insert_dt timestamp, update_dt timestamp, active_flag char(1))
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:description,cf1:insert_dt,cf1:update_dt,cf1:active_flag")
TBLPROPERTIES ("hbase.table.name" = "hbase_actions")
LOCATION 'wasb://linuxxxxxxhdinsightcluster@oxigxxxxxxcompute.blob.core.windows.net/test/actionshbasetest';
*********************************************************************************
To move data from hive to hbase:
*********************************************************************************
INSERT OVERWRITE TABLE hbase_wallets_test SELECT Id FROM oxi_consolidated.Wallets;
No comments:
Post a Comment