On Wed, Mar 3, 2010 at 6:05 AM, prakash sejwani <[email protected]> wrote: > Hi all, > I have a tables in hive of product_hits and company_hits i want to > export the data to my web application which is build on ruby on rails > framework to show this data in my app. > > table description are as follows > > -- This table will store the hits (data from the server log) for each > product > CREATE TABLE product_hits ( > ip STRING, ident STRING, user STRING, time STRING, > method STRING, resource STRING, protocol STRING, status INT, > length INT, referer STRING, agent STRING, > product_id INT, > company_id INT, > ip_country STRING, > product_name STRING, > company_name STRING > ) > ROW FORMAT DELIMITED FIELDS TERMINATED BY "\t" LINES TERMINATED BY "\n" > STORED AS TEXTFILE; > > -- As above, except for companies > CREATE TABLE company_hits ( > ip STRING, ident STRING, user STRING, time STRING, > method STRING, resource STRING, protocol STRING, status INT, > length INT, referer STRING, agent STRING, > company_id INT, > ip_country STRING, > company_name STRING > ) > ROW FORMAT DELIMITED FIELDS TERMINATED BY "\t" LINES TERMINATED BY "\n" > STORED AS TEXTFILE; > > > Thanks, > prakash >
Take a look at http://svn.apache.org/viewvc/hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java?revision=907950&view=markup http://svn.apache.org/viewvc/hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q?revision=810696&view=markup UDFDBOutput is a 'quick and dirty' export UDF. It is not going to help you with schema issues but I can get data out of hive into a jdbc database without a middle man.
