Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Loading json data to hbase table using pyspark

Explorer

Hi,

I have a use case where i need to load json data to hbase using pyspark with row key and 3 column families,Can anyone please help me how to do this.

Below is the json i want to load.

{ "ticid": "1496", "ticlocation": "vizag", "custnum": "222", "Comments": { "comment": [{ "commentno": "1", "desc": "journey", "passengerseat": { "intele": "09" }, "passengerloc": { "intele": "s15" } }, { "commentno": "5", "desc": " food", "passengerseat": { "intele": "09" }, "passengerloc": { "intele": "s15" } }, { "commentno": "12", "desc": " service", "passengerseat": { "intele": "09" }, "passengerloc": { "intele": "s15" } }] }, "Rails": { "Rail": [{ "Traino": "AP1545", "startcity": "vizag", "passengerseat": "5" }, { "Traino": "AP1555", "startcity": "HYD", "passengerseat": "15A" }] } }

ticid is the row key

ticlocation ,custnum need to be in column family 1

Comments needs to be column family 2

Rails needs to be column family 3

2 REPLIES 2

@srini

You can use hbase connector for this. Here is a step by step example on how to achieve this:

https://community.hortonworks.com/articles/147327/accessing-hbase-tables-and-querying-on-dataframes....

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

@srini If the above answer helped addressed your question, please take a moment to login and click the "accept" link on the answer.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.