hive导数据到neo4j

 

sudo -u hive hive -e "SELECT  a.user_id,   b.realname,  b.card_id,  c.username,  e.tel,  a.addip,    a.borrow_success_time,  d.LATE_DAYS,   f.phone1,  f.phone2 FROM mobp2p.yyd_borrow a LEFT JOIN customer_mobp2p.yyd_approve_realname b ON a.user_id=b.user_id AND a.add_product =b.add_product LEFT JOIN customer_mobp2p.yyd_users c ON a.user_id=c.user_id AND a.add_product =c.add_product LEFT JOIN cw_mobp2p.t_repay_schedule d  ON a.borrow_nid=d.borrow_nid AND d.LATE_DAYS>=30 LEFT JOIN  customer_mobp2p.yyd_approve_job e ON a.user_id=e.user_id AND a.add_product =e.add_product LEFT JOIN customer_mobp2p.yyd_approve_contact f ON a.user_id=f.user_id AND a.add_product =f.add_product WHERE a.borrow_type IN (8,11,12) AND a.STATUS IN(3,5) AND a.borrow_success_time>UNIX_TIMESTAMP('2017-09-01 00:00:00') AND a.borrow_success_time<UNIX_TIMESTAMP('2017-12-01 00:00:00');" >> neo4j.csv

 

sed -i 's/\t/,/g' neo4j.csv

sed -i '1i\user_id,realname,card_id,username,tel,addip,borrow_success_time,LATE_DAYS,phone1,phone2' neo4j.csv

 

bin/neo4j stop

 

bin/neo4j-import --into data/graph.db --nodes:label /data/neo4j.csv

 

bin/neo4j start

您可以选择一种方式赞助本站