0
votes

I've been trying to store csv data into a table in a database using a pig script.

But instead of inserting the data into a table in a database I created a new file in the metastore.

Can someone please let me know if it is possible to insert data into a table in a database with a pig script, and if so what that script might look like?

2

2 Answers

0
votes

You can take a look at DBStorage, but be sure to include the JDBC jar in your pig script and declaring the UDF.

The documentation for the storage UDF is here:

http://pig.apache.org/docs/r0.12.0/api/org/apache/pig/piggybank/storage/DBStorage.html

0
votes

you can use:

STORE into tablename USING org.apache.hcatalog.pig.HCatStorer()