python使用thrift访问操作hbase
1.看不同语言对hbase的thrift访问demo,可以参考examples/thrift/DemClient.*,有c++,java,php,pl,py,rb等多种语言
2.使用python访问hbase需要借助thrift的帮助,首先通过 --gen生成python的hbase的thrift脚本
使用命令:
提供的方法有:void enableTable(Bytes tableName)enable表void disableTable(Bytes tableName)disable表bool isTableEnabled(Bytes tableName)查看表状态void compact(Bytes tableNameOrRegionName)void majorCompact(Bytes tableNameOrRegionName)getTableNames()getColumnDescriptors(Text tableName)getTableRegions(Text tableName)void createTable(Text tableName, columnFamilies)void deleteTable(Text tableName)get(Text tableName, Text row, Text column)getVer(Text tableName, Text row, Text column, i32 numVersions)getVerTs(Text tableName, Text row, Text column, i64 timestamp, i32 numVersions)getRow(Text tableName, Text row)getRowWithColumns(Text tableName, Text row, columns)getRowTs(Text tableName, Text row, i64 timestamp)getRowWithColumnsTs(Text tableName, Text row, columns, i64 timestamp)getRows(Text tableName, rows)getRowsWithColumns(Text tableName, rows, columns)getRowsTs(Text tableName, rows, i64 timestamp)getRowsWithColumnsTs(Text tableName, rows, columns, i64 timestamp)void mutateRow(Text tableName, Text row, mutations)void mutateRowTs(Text tableName, Text row, mutations, i64 timestamp)void mutateRows(Text tableName, rowBatches)void mutateRowsTs(Text tableName, rowBatches, i64 timestamp)i64 atomicIncrement(Text tableName, Text row, Text column, i64 value)void deleteAll(Text tableName, Text row, Text column)void deleteAllTs(Text tableName, Text row, Text column, i64 timestamp)void deleteAllRow(Text tableName, Text row)void deleteAllRowTs(Text tableName, Text row, i64 timestamp)ScannerID scannerOpenWithScan(Text tableName, TScan scan)ScannerID scannerOpen(Text tableName, Text startRow, columns)ScannerID scannerOpenWithStop(Text tableName, Text startRow, Text stopRow, columns)ScannerID scannerOpenWithPrefix(Text tableName, Text startAndPrefix, columns)ScannerID scannerOpenTs(Text tableName, Text startRow, columns, i64 timestamp)ScannerID scannerOpenWithStopTs(Text tableName, Text startRow, Text stopRow, columns, i64 timestamp)scannerGet(ScannerID id)scannerGetList(ScannerID id, i32 nbRows)void scannerClose(ScannerID id)