Skip to content

pranab/chargeur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction
============

Cargeur is a simple CSV file loader for Hbase and Cassandra. HBase is fully supported now. Will add
Cassandra support. A JSON config file defines metadta mapping between csv and NOSQL table, column family etc.

Mapping
=======
A csv column can be mapped to one or more NOSQL db column. For mapping to mutiple columns, the installed 
preLoadHandler is supposed to split a CSV column into mutiple parts. Also multipkle csv columns could be 
mapped to one NOSQL db column.

Some of the coulns can be designated as part of the row key. All columns designated as part of row key
are concatanated to create NOSQL db row key.

One or more columns with constant value can be injected by passing a Map<String,String> to the API. These
data elements are designated as sideData

API
===
The load() method in the Loader class is the entry point to the API

Solr Indexing
=============
Data can optionally be indexed with Solr. All attributes with indexed flag set are indexed. 

Configuration
=============

Here is a sample configuration for loading product data from csv to a HBase table while being indexed
with Solr

{
	"name" : "product catalog",
	"database" : "hbase",
	"table" : "products",
	"colNameInFirstRow" : true,
	"rowKey" : ["seller", "category", "sku"],
	"batchSize" : 5,
	"preLoadHandler" : "org.chargeur.handler.ProductPreLoadHandler",
	"indexManagerClass" : "org.chargeur.core.SolrIndexManager",
	"indexServerUrl" : "http://localhost:8983/solr",
	"columnMappers" : 
	[
		{
			"name" : "sku",
			"ordinal" : 1,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "sku",
			"useAsRowKey" : true,
			"maxSize" : 20,
			"sideData" : false,
			"indexed" : true
		},
		{
			"name" : "seller",
			"ordinal" : 0,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "seller",
			"useAsRowKey" : true,
			"maxSize" : 30,
			"sideData" : true,
			"defaultValue" : "anySeller",
			"indexed" : true
		},
		{
			"name" : "model",
			"ordinal" : 3,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "model",
			"useAsRowKey"  : false,
			"sideData" : false
		},
		{
			"name" : "title",
			"ordinal" : 4,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "title",
			"useAsRowKey" : false,
			"sideData" : false,
			"indexed" : true
		},
		{
			"name" : "description",
			"ordinal" : 5,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "description",
			"useAsRowKey" : false,
			"sideData" : false,
			"indexed" : true
		},
		{
			"name" : "category",
			"ordinal" : 4,
			"dataType" : "string",
			"colFamily" : "main",
			"col" : "category",
			"useAsRowKey" : true,
			"maxSize" : 30,
			"sideData" : false,
			"defaultValue" : "generic",
			"indexed" : true
		},
		{
			"name" : "price",
			"ordinal" : 17,
			"colFamily" : "main",
			"col" : "price"
		},
		{
			"name" : "details1",
			"ordinal" : 6,
			"colFamily" : "other",
			"col" : "details",
			"manyToOne" : true,
			"indexed" : true
		},
		{
			"name" : "details2",
			"ordinal" : 7,
			"colFamily" : "other",
			"col" : "details",
 			"manyToOne" : true,
			"indexed" : true
		},
		{
			"name" : "details3",
			"ordinal" : 8,
			"colFamily" : "other",
			"col" : "details",
			"manyToOne" : true,
			"indexed" : true
		},
		{
			"name" : "details4",
			"ordinal" : 9,
			"colFamily" : "other",
			"col" : "details",
			"manyToOne" : true,
			"indexed" : true
		},
		................
		{
			"name" : "image1",
			"ordinal" : 19,
			"colFamily" : "other",
			"col" : "images"
		},
		{
			"name" : "image2",
			"ordinal" : 20,
			"colFamily" : "other",
			"col" : "images"
		},
		...............

	]
}

About

CSV file loader for HBase and Cassandra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages