문제

How do I store my pig output into greenplum database? I had tried

STORE relation INTO 'table' USING org.apache.pig.piggybank.storage.DBStorage('DriverName', 'jdbc:postgresql://host/db', 'id', 'password', 'INSERT INTO table (cust_id,name,age,gender,city,nationality)');

he job fails in this. Is there any other way?

도움이 되었습니까?

해결책

To expand the answer a bit:

REGISTER postgresql-9.2-1002.jdbc4.jar;
REGISTER piggybank.jar;
STORE relation INTO 'my_table' USING org.apache.pig.piggybank.storage.DBStorage( 
    'org.postgresql.Driver', 'jdbc:postgresql://host:port/db', 'user', 'password',
    'INSERT INTO my_table VALUES (?,?,?,?,?,?)');

Please note that the SQL table should exist prior to the load. This was verified to work with PostgreSQL 9.3

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top